【77.39%】【codeforces 734A】Anton and Danik
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Anton likes to play chess, and so does his friend Danik.
Once they have played n games in a row. For each game it’s known who was the winner — Anton or Danik. None of the games ended with a tie.
Now Anton wonders, who won more games, he or Danik? Help him determine this.
Input
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of games played.
The second line contains a string s, consisting of n uppercase English letters ‘A’ and ‘D’ — the outcome of each of the games. The i-th character of the string is equal to ‘A’ if the Anton won the i-th game and ‘D’ if Danik won the i-th game.
Output
If Anton won more games than Danik, print “Anton” (without quotes) in the only line of the output.
If Danik won more games than Anton, print “Danik” (without quotes) in the only line of the output.
If Anton and Danik won the same number of games, print “Friendship” (without quotes).
Examples
input
6
ADAAAA
output
Anton
input
7
DDDAADA
output
Danik
input
6
DADADA
output
Friendship
Note
In the first sample, Anton won 6 games, while Danik — only 1. Hence, the answer is “Anton”.
In the second sample, Anton won 3 games and Danik won 4 games, so the answer is “Danik”.
In the third sample, both Anton and Danik won 3 games and the answer is “Friendship”.
【题目链接】:http://codeforces.com/contest/734/problem/A
【题解】
统计一下两个字符出现的次数;
比较大小即可;
好水的题。。
不,这已经水破天际了;
ps:D题手慢了TAT,捶胸顿足状。
【完整代码】
#include <bits/stdc++.h>
using namespace std;
int a[2],n;
int main()
{
cin >> n;
string s;
cin >> s;
for (int i = 0;i <= n-1;i ++)
if (s[i] == 'A')
a[0]++;
else
if (s[i] == 'D')
a[1] ++;
if (a[0] == a[1])
puts("Friendship");
else
if (a[0] > a[1])
puts("Anton");
else
puts("Danik");
return 0;
}
【77.39%】【codeforces 734A】Anton and Danik的更多相关文章
- 【35.02%】【codeforces 734A】Vladik and flights
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【 BowWow and the Timetable CodeForces - 1204A 】【思维】
题目链接 可以发现 十进制4 对应 二进制100 十进制16 对应 二进制10000 十进制64 对应 二进制1000000 可以发现每多两个零,4的次幂就增加1. 用string读入题目给定的二进制 ...
- 【19.77%】【codeforces 570D】Tree Requests
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【39.66%】【codeforces 740C】Alyona and mex
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【23.39%】【codeforces 558C】Amr and Chemistry
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【77.78%】【codeforces 625C】K-special Tables
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- 【39.29%】【codeforces 552E】Vanya and Brackets
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【13.77%】【codeforces 734C】Anton and Making Potions
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【codeforces 750D】New Year and Fireworks
time limit per test2.5 seconds memory limit per test256 megabytes inputstandard input outputstandard ...
随机推荐
- cdn缓存
1:缓存是什么? 首先.看看没有站点没有接入CDN时.用户浏览器与server是怎样交互的: 假设中间加上一层CDN,那么用户浏览器与server的交互例如以下: client浏览器先检查是否有本地缓 ...
- BC 52 div2 A Victor and Machine
简单数学题,把这道题目贴上去的不过为了不想看到这个月写了某个数字篇博客,该数字有点不吉利... 近期没有学习的欲望.. . 集中不了注意力,今天打BC还是做出来一题,尽管涨分了,真心希望能接近cf的水 ...
- Day2:列表、元组
一.列表 1.定义与访问元素(按索引) #!/usr/bin/env python # -*- coding:utf-8 -*- # Author:Hiuhung Wan list_a = [&quo ...
- P2P借款的几种情况
借款,至少出现2种人,借款人和出借人.根据人的性质,企业和个人,分成4种情况. 企业-个人,企业-企业,个人-企业,个人-个人. P2P平台可能出现几种情况: 个人-个人 2种情况: a. 借款人 ...
- [Angular] Reactive Store and AngularFire Observables
A simple store implemenet: import { Observable } from 'rxjs/Observable'; import { BehaviorSubject } ...
- css3-12 transition+css或transform实现过渡动画
css3-12 transition+css或transform实现过渡动画 一.总结 一句话总结:首先要设置hover后的效果,然后在transition里面指定执行哪些样式和执行时间为多长. 1. ...
- VS_VERSION_INFO
VS_VERSION_INFO这里可以修改ocx的版本号
- Go语言实战_自己定义OrderedMap
一. 自己定义OrderedMap 在Go语言中.字典类型的元素值的迭代顺序是不确定的.想要实现有固定顺序的Map就须要让自己定义的 OrderedMap 实现 sort.Interface 接口类型 ...
- error C2220: warning treated as error - no 'object' file generated warning C4819: The file contains a character that cannot be represented in the current code page (936).
用Visual Studio2015 编译时,遇到如下编译错误: error C2220: warning treated as error - no 'object' file generated ...
- 【23.33%】【codeforces 557B】Pasha and Tea
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...