【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

最大值出现次数是偶数。
那么就取次大值。
次大值也是偶数?
=>再次
因为你绝对不能取偶数个的。
取了对方就总是能面对一个奇数的情况了。
则对面总是能拿走最后一个了。

【代码】

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int N = 1e5;
  4. int n,a[N+10];
  5. int main(){
  6. #ifdef LOCAL_DEFINE
  7. freopen("rush_in.txt", "r", stdin);
  8. #endif
  9. ios::sync_with_stdio(0),cin.tie(0);
  10. cin >> n;
  11. for (int i = 1;i <= n;i++) cin >> a[i];
  12. sort(a+1,a+1+n);
  13. for (int i = n;i>=1;i--){
  14. int j = i;
  15. while (j-1>=1 && a[j-1]==a[i]) j--;
  16. int num = j-i+1;
  17. if (num&1){
  18. return cout<<"Conan"<<endl,0;
  19. }
  20. i = j;
  21. }
  22. cout <<"Agasa"<<endl;
  23. return 0;
  24. }

【Codecraft-18 and Codeforces Round #458 (Div. 1 + Div. 2, combined) B】 Conan and Agasa play a Card Game的更多相关文章

  1. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  2. Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块

    Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块 [Problem Description] ​ ...

  3. Educational Codeforces Round 71 (Rated for Div. 2)-E. XOR Guessing-交互题

    Educational Codeforces Round 71 (Rated for Div. 2)-E. XOR Guessing-交互题 [Problem Description] ​ 总共两次询 ...

  4. Educational Codeforces Round 72 (Rated for Div. 2)-D. Coloring Edges-拓扑排序

    Educational Codeforces Round 72 (Rated for Div. 2)-D. Coloring Edges-拓扑排序 [Problem Description] ​ 给你 ...

  5. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  6. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  7. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  8. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  9. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...

随机推荐

  1. [ZJOI2012]旅游 对偶图 树的直径

    Code: // luogu-judger-enable-o2 #include<cstdio> #include<iostream> #include<algorith ...

  2. Javascript中继承

    Javascript中继承 构造函数继承 原型继承 call和apply继承 组合继承

  3. WSGI和CGI

    https://www.zhihu.com/question/19998865 https://segmentfault.com/a/1190000003069785

  4. NodeJS学习笔记 (21)事件机制-events(ok)

    模块概览 events模块是node的核心模块之一,几乎所有常用的node模块都继承了events模块,比如http.fs等. 模块本身非常简单,API虽然也不少,但常用的就那么几个,这里举几个简单例 ...

  5. Python学习七步走

    在周五的下午三点钟(为什么是这个时间?因为事情总会在周五下午三点钟发生),你收到一条通知,客户发现你的软件出现一个错误.在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到 ...

  6. 关于memset赋最值

    出处[辗转山河弋流歌 by 空灰冰魂] blog.csdn.net/vmurder/article/details/46537613 memset(a, 0x3f, sizeof(a)) //int, ...

  7. 紫书 例题 10-8 UVa 1262 (暴力枚举)

    递归一遍遍历所有情况就ok了 #include<cstdio> #include<cstring> #define REP(i, a, b) for(int i = (a); ...

  8. JDBC连接SQL Server 2005 报错Connection refused: connect

    com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败.错误:“Connect ...

  9. leetcode笔记:Range Sum Query - Mutable

    一. 题目描写叙述 Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), ...

  10. Android之Handler源代码深入解析

    闲着没事.就来看看源代码,看看源代码的各种原理,会用仅仅是简单的,知道为什么才是最牛逼的. Handler源代码分析那,从使用的步骤来边用边分析: 1.创建一个Handler对象:new Handle ...