Codeforces Round 893 (Div. 2) A---C

1    Buttons

博弈题,先找公共再找自己

#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int N=3e5+1;
const int M=1e3+1;
const int MOD=10000007;
void solve(){
	int a,b,c;
	cin>>a>>b>>c;
	int c1=c/2+c%2;
	int c2=c-c1;
	// cout<<c1<<" "<<c2;
	if((a+c1)>(b+c2)) cout<<"First"<<endl;
	else cout<<"Second"<<endl;
}
signed main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int T=1;
	cin>>T;
	while(T--) solve();
}

2.   The Walkway

读题读了半天后来发现都去写c了,题目不难就是难理解,注意商家在第一个位置的特判

#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int N=3e5+1;
const int M=1e3+1;
const int MOD=10000007;
int a[N],b[N];
void solve(){
	int n,m,d;
	cin>>n>>m>>d;
	for(int i=1;i<=m;i++) cin>>a[i];
	a[0]=0,b[0]=0;
	if(a[1]==1) b[1]=0;
	else b[1]=a[1]-2;
	 	
	for(int i=2;i<=m;i++){
		b[i]=a[i]-a[i-1]-1;
			}
			b[m+1]=n-a[m];
			map<int,int>mp;
			int res=0;
			if(a[1]!=1) res++;
			for(int i=1;i<=m;i++){
				res+=b[i]/d+1;
			}
			res+=b[m+1]/d;
			int mx=0;
			for(int i=2;i<=m;i++){
				int x1=b[i]/d+b[i+1]/d+1;
				int x2=(b[i]+b[i+1]+1)/d;
				mx=max(mx,x1-x2);
				mp[x1-x2]++;
			}
// 			第一个位置的特判
			if(a[1]==1){
				int x1=b[2]/d+1;
				int x2=b[2]/d+1;
				mp[x1-x2]++;
				mx=max(mx,x1-x2);
}
else{
	int x1=b[1]/d+b[2]/d+1;
	int x2=(b[1]+b[2]+1)/d;
	 	mx=max(mx,x1-x2);
	 	mp[x1-x2]++;
}
cout<<res-mx<<" "<<mp[mx]<<endl;
}
signed main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int T=1;
	cin>>T;
	while(T--) solve();
}

3.Yet Another Permutation Problem

只要按照1 2 4 8……3 6 12……这样输出就行,输出以后记得标记,避免重复输出,记得清空数组,第一次没清wa了一发

#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int N=3e5+1;
const int M=1e3+1;
const int MOD=10000007;
int a[N];
void solve(){
	memset(a,0,sizeof a);
	int n;
	cin>>n;
	cout<<"1"<<" ";
	a[1]=1;
	for(int i=2;i<=n;i++){
		int tmp=i;
		while(tmp<=n){
			if(!a[tmp]) cout<<tmp<<" ";
			a[tmp]=1;
			tmp=tmp*2;
		}
	}
	cout<<endl;
}
signed main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int T=1;
	cin>>T;
	while(T--) solve();
}

抱歉,根据提供的引用内容,我无法理解你具体想要问什么问题。请提供更清晰明确的问题,我将竭诚为你解答。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Codeforces Round 860 (Div. 2)题解](https://blog.csdn.net/qq_60653991/article/details/129802687)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [【CodeforcesCodeforces Round 865 (Div. 2) (补赛)](https://blog.csdn.net/t_mod/article/details/130104033)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Codeforces Round 872 (Div. 2)(前三道](https://blog.csdn.net/qq_68286180/article/details/130570952)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值