Codeforces 1190B

有n堆石子,两个人轮流,每次只能拿一个,不能拿了或者拿完后有两堆石子的数量相同(可能两堆都是0)的话会输
开局有几种情况第一个人是一定会输的即
cnt[0] >= 2
cnt[x] >= 3
amt(cnt[x]) > 1
cnt[x] = 2 && cnt[x-1] >= 1
由于要避免产生两堆相同的石子,故如果当前局势未结束的话必定先拿相对小的,使其更小(在保证没有两堆相同的情况下),可以想到石子数最后一定是0,1,2…,n
所以求出当前局势到最终局势走的步数的奇偶性可以判断胜负

/*************************************************************************
	> File Name: 1195D.cpp
	> Author: windhxs
	> Mail: 865022197@163.com 
	> Created Time: 2019年07月19日 星期五 17时04分21秒
 ************************************************************************/

#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
const int N = 1e5 + 10;
int n;
map<int,int> cnt;
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("data.in","r",stdin);
	//freopen("data.out","w",stdout);
	cin>>n;
	for(int i = 0 ; i < n; i++) {
		int x;cin>>x;
		if(!cnt.count(x)) cnt[x] = 0 ;
		cnt[x]++;
	}
	int flag = 0,num = 0;
	if(cnt.count(0) && cnt[0] >= 2) flag = 1;
	for(auto u : cnt) {
		if(u.s > 2){
			flag = 1;
			break;
		}
		if(u.s == 2 && cnt.count(u.f - 1) ) {
			flag = 1;
			break;
		}
		if(u.s == 2) num++;
	}
	if(num >= 2) flag = 1;
	if(flag) cout<<"cslnb"<<endl;
	else {
		int i = 0,sum = 0;
		for(auto u : cnt){
			for(int j = 0 ;j < u.s ;j ++){
				sum += u.f - i;
				i++;
			}
		}
		if(sum % 2) cout<<"sjfnb"<<endl;
		else cout<<"cslnb"<<endl;
	}
	return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值