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 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.