-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path571-anton-and-danik.cpp
More file actions
56 lines (54 loc) · 877 Bytes
/
Copy path571-anton-and-danik.cpp
File metadata and controls
56 lines (54 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Anton and Danik [734A]
* Problem: https://codeforces.com/problemset/problem/734/A
* Verdict: ACCEPTED Solved: 2020-08-11
* Language: C++17 (GCC 7-32)
* Runtime: 31 ms Memory: 3900 KB
* Tags: implementation, strings
* Author: BidoTeima
* Source: https://codeforces.com/contest/734/submission/89575265
*/
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
void test_case()
{
string s;
cin >> s;
cin >> s;
unsigned d = 0;
unsigned a = 0;
for (const auto& x : s)
{
if (x == 'A') ++a;
else ++d;
if (d > s.length() / 2)
{
cout << "Danik";
exit(0);
}
if (a > s.length() / 2)
{
cout << "Anton";
exit(0);
}
}
if (a == d)
{
cout << "Friendship";
}
else if (a > d)
{
cout << "Antonio";
}
else if(d > a)
{
cout << "Danik";
}
}
int main()
{
test_case();
return 0;
}