Codeforces 734A A. Anton and Danik Solution

Solve in C++:

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a=0,d=0,t,i,l;
    char s[100001];
    while(cin>>t)
    {
        for(i=0; i<t; i++)
        {
            cin>>s[i];
            if(s[i]=='A')
                a++;
            else if(s[i]=='D')
                d++;
        }
        if(a>d)
            cout<<"Anton"<<endl;
        else if(d>a)
            cout<<"Danik"<<endl;
        else if(a==d)
            cout<<"Friendship"<<endl;
    a=0,d=0;

    }

}

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.