【Codecraft-18 and Codeforces Round #458 (Div. 1 + Div. 2, combined) B】 Conan and Agasa play a Card Game
and Codeforces div 18 round Game Play Card
2023-09-14 09:03:45 时间
【链接】 我是链接,点我呀:)
【题意】
【题解】
最大值出现次数是偶数。 那么就取次大值。 次大值也是偶数? =>再次 因为你绝对不能取偶数个的。 取了对方就总是能面对一个奇数的情况了。 则对面总是能拿走最后一个了。【代码】
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n,a[N+10];
int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n;
for (int i = 1;i <= n;i++) cin >> a[i];
sort(a+1,a+1+n);
for (int i = n;i>=1;i--){
int j = i;
while (j-1>=1 && a[j-1]==a[i]) j--;
int num = j-i+1;
if (num&1){
return cout<<"Conan"<<endl,0;
}
i = j;
}
cout <<"Agasa"<<endl;
return 0;
}
相关文章
- ORA-32602: FREEPOOLS and FREELIST GROUPS cannot be used together ORACLE 报错 故障修复 远程处理
- ORA-39933: Parent table string.string and its nested table columns are not fully contained in the transportable set. ORACLE 报错 故障修复 远程处理
- ORA-01586: database must be mounted EXCLUSIVE and not open for this operation ORACLE 报错 故障修复 远程处理
- 多条件查询MySQL中使用And多条件查询的步骤(mysql中and)
- MySQL: Database Administration and Management(mysqldbo)
- 深入浅出:MySQL中AND和OR运算符使用方法(mysql中and和or)
- Exploring the Power of Linux 2G: A Guide to Maximizing Performance and Efficiency(linux2g)
- Exploring the Benefits and Challenges of NW336 Linux for Advanced Computing(nw336linux)
- Exploring the Power of macOS for PDF Management and Beyond(macospdf)
- Exploring the World of Linux UTC: Understanding Its Importance and Functionality(linuxutc)
- Exploring the Power of Oracle and Redis for Enterprise Database Management(oracleredis)
- MySQL中AND的使用方法解析(mysql中and的用法)
- Mysql中强大的AND运算符的使用方法探究(mysql中and的使用)
- 管理系统设计与实现Research and Implementation of a Personal Salary Management System using MySQL
- Oracle 数据库中使用AND拼接的威力(oracle中and拼接)