Codeforces Round 913 (Div. 3)

Dashboard - Codeforces Round 913 (Div. 3) - Codeforces

#include<bits/stdc++.h>
using namespace std;

void solve()
{
	string s;
	cin>>s;
	for(char a='a';a<='h';a++)
	{
		if(s[0]!=a) printf("%c%c\n",a,s[1]);
	}
	for(char a='1';a<='8';a++)
	{
		if(s[1]!=a) printf("%c%c\n",s[0],a);
	}
}

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve();
	}
}

#include<bits/stdc++.h>
using namespace std;

void solve()
{
	string s;
	cin>>s;
	string ans="";
	int B=0,b=0;
	for(int i=s.size()-1;i>=0;i--)
	{
		if(s[i]=='B') B++;
		else if(s[i]=='b') b++;
		else if(s[i]>='a' && s[i]<='z')
		{
			if(b)
			{
				b--;
				continue;
			}else{
				ans+=s[i];
			}
		}else{
			if(B){
				B--;
				continue;
			}else{
				ans+=s[i];
			}
		}
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<endl;
}


int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve();
	}
}

#include<bits/stdc++.h>
using namespace std;

void solve()
{
	int n,maxx=0;
	string s;
	map<char,int>mp;
	cin>>n>>s;
	for(char x:s)
	{
		mp[x]++;
		maxx=max(maxx,mp[x]);
	}
	if(maxx<=n/2) cout<<n%2<<endl;
	else cout<<maxx-(n-maxx)<<endl;
}


int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve();
	}
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PII pair<int, int>
#define x first
#define y second
const int N=3e5+10;
PII q[N];
int n;

bool check(int x)
{
	int l0=0,r0=0;
	for(int i=1;i<=n;i++)
	{
		l0=max(q[i].x,l0-x);
		r0=min(q[i].y,r0+x);
		if(l0>r0) return false;
	}
	return true;
}

void solve()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>q[i].x>>q[i].y;
	int l=0,r=3e9;
	while(l<r)
	{
		int mid=l+r>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	cout<<l<<endl;
}

signed main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve();
	}
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
map<int,int> mp;
int n;

void init()
{
	for(int i=0;i<=9;i++)
	{
		for(int j=0;j<=9;j++)
		{
			for(int k=0;k<=9;k++)
			{
				mp[i+j+k]++;
			}
		}
	}
}

void solve()
{
	cin>>n;
	int ans=1,u=n;
	while(u)
	{
		ans*=mp[u%10];
		u/=10;
	}
	cout<<ans<<endl;
}

signed main()
{
	init();
	int t;
	cin>>t;
	while(t--)
	{
		solve();
	}
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值