Codeforces Round #633 (Div. 2)

A

#include 
using namespace std;
typedef long long ll;
typedef pair<long long,long long> pll;
template<class T>inline void rd(T &x){x=0;char o,f=1;while(o=getchar(),o<48)if(o==45)f=-f;do x=(x<<3)+(x<<1)+(o^48);while(o=getchar(),o>47);x*=f;}
const int inf=~0u>>2; //1073741823
const ll INF=~0ull>>2;//4611686018427387903
const int maxn=1e3+10;
ll n;
void solve()
{
	rd(n);
	printf("%lld\n",n);
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("stdin.in","r",stdin);
	//freopen("stdout.out","w",stdout);
	#endif

	ll T;
    rd(T);
    while(T--)

	solve();
    return 0;
}

B

#include 
using namespace std;
typedef long long ll;
typedef pair<long long,long long> pll;
template<class T>inline void rd(T &x){x=0;char o,f=1;while(o=getchar(),o<48)if(o==45)f=-f;do x=(x<<3)+(x<<1)+(o^48);while(o=getchar(),o>47);x*=f;}
const int inf=~0u>>2; //1073741823
const ll INF=~0ull>>2;//4611686018427387903
const int maxn=1e5+10;
ll n,a[maxn];
void solve()
{
	vector<ll>ans;
	rd(n);
	for(ll i=1;i<=n;i++) rd(a[i]);
	sort(a+1,a+1+n);
	if(n%2==1)
	{
		ans.push_back(a[(n+1)/2]);
		ll temp=(n+1)/2;
		for(ll i=1;i+temp<n;i++) ans.push_back(a[temp+i]),ans.push_back(a[temp-i]);
		ans.push_back(a[n]),ans.push_back(a[1]);
	}
	else
	{
		for(ll i=n/2;i>1;i--) ans.push_back(a[n+1-i]),ans.push_back(a[i]);
		ans.push_back(a[n]),ans.push_back(a[1]);
	}
	for(ll i=0;i<n;i++)
		printf("%lld ",ans[i]);
	puts("");
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("stdin.in","r",stdin);
	//freopen("stdout.out","w",stdout);
	#endif

	ll T;
    rd(T);
    while(T--)

	solve();
    return 0;
}

C

#include 
using namespace std;
typedef long long ll;
typedef pair<long long,long long> pll;
template<class T>inline void rd(T &x){x=0;char o,f=1;while(o=getchar(),o<48)if(o==45)f=-f;do x=(x<<3)+(x<<1)+(o^48);while(o=getchar(),o>47);x*=f;}
const int inf=~0u>>2; //1073741823
const ll INF=~0ull>>2;//4611686018427387903
const int maxn=1e5+10;
ll n,a[maxn];
void solve()
{
	rd(n);
	ll maxx=-INF,ans=0,cha=0;
	for(ll i=0;i<n;i++)
	{
		rd(a[i]);
		if(i)
			cha=max(cha,maxx-a[i]);
		maxx=max(maxx,a[i]);
	}
	//cout<
	ll t=1;
	while(cha>0)
	{
		ans++;
		cha-=t;
		t*=2;
	}
	
	printf("%lld\n",ans);
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("stdin.in","r",stdin);
	//freopen("stdout.out","w",stdout);
	#endif

	ll T;
    rd(T);
    while(T--)

	solve();
    return 0;
}

你可能感兴趣的:(补题,everyday,contest)