CodeForces 734 A.Anton and Danik(水~)
来源:互联网 发布:手机移动办公软件 编辑:程序博客网 时间:2024/06/05 16:09
Description
两个人玩了n局游戏,问谁赢的次数多
Input
第一行输入一整数n表示游戏局数,之后一个长度为n的字符串表示胜负情况,A表示Anton赢了,D表示Danik赢了(1<=n<=1e5)
Output
如果Anton赢的多则输出Anton,如果Danik赢的多则输出Danik,如果一样多则输出Friendship
Sample Input
6
ADAAAA
Sample Output
Anton
Solution
水题
Code
#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<cmath>#include<vector>#include<queue>#include<map>#include<set>#include<ctime>using namespace std;typedef long long ll;#define INF 0x3f3f3f3f#define maxn 1111111char s[maxn];int n,a,b;int main(){ while(~scanf("%d",&n)) { scanf("%s",s); a=b=0; for(int i=0;i<n;i++) if(s[i]=='A')a++; else b++; if(a>b)printf("Anton\n"); else if(a<b)printf("Danik\n"); else printf("Friendship\n"); } return 0;}
0 0
- CodeForces 734 A.Anton and Danik(水~)
- 【77.39%】【codeforces 734A】Anton and Danik
- codeforces 734A .Anton and Danik
- Codeforces-734A-Anton and Danik(很水)
- codeforces——734A——Anton and Danik
- A. Anton and Danik
- Codeforces 734A Anton and Danik(水题,没参加晚上零点场)
- Codeforces Round #379 (Div. 2) A. Anton and Danik(水题)
- CodeForces 734 B.Anton and Digits(水~)
- Codeforces 443A Anton and Letters(水题)
- CodeForces 443A Anton and Letters
- CodeForces 443A Anton and Letters
- 【codeforces 785A】Anton and Polyhedrons
- Codeforces Round#404 A. Anton and Polyhedrons
- CodeForces 785A Anton and Polyhedrons【水题】
- Codeforces-734B-Anton and Digits(贪心)
- Codeforces-734C-Anton and Making Potions(枚举+二分)
- CodeForces 734D - Anton and Chess (模拟)
- Java\Android进阶代码提炼师之代码重构原则
- Android中的跨进程通信AIDL、Binder源码详解
- ubuntu开机自动运行用Qt写的程序
- HashTable和HashMap的区别详解
- openstack创建一个完整的项目过程
- CodeForces 734 A.Anton and Danik(水~)
- 数据结构与算法(十四)红黑树
- 禅道-从windows7迁移至ubuntu14.04之四
- 如何在一台半新半旧的linux上装methylkit
- Problem B: 时间和日期类(II)
- tensorflow初次接触记录,我用python写的tensorflow第一个模型
- 项目及环境问题记录汇总
- java导出csv
- Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'name' in 'field list'