您的位置:首页 > 其它

Codeforces Round #379 (Div. 2) A. Anton and Danik(水题)

2016-11-21 18:34 573 查看
题目链接:http://codeforces.com/contest/734/problem/A

【中文题意】给你一个n,然后输入一个长度为n的字符串,然后比较在这个字符串中’A’的个数多还是’D’的个数多然后对应输出就可以了。

【AC代码】

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int main()
{
int n,s1=0,s2=0;
char c[100005];
scanf("%d",&n);
scanf("%s",c);
for(int i=0;i<n;i++)
{
if(c[i]=='A')s1++;
else s2++;
}
if(s1>s2)
{
printf("Anton\n");
}
else if(s1==s2)
{
printf("Friendship\n");
}
else
{
printf("Danik\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  codeforces