Monday, March 13, 2023

Codeforces Round 379 (Div. 2) - 734 A. Anton and Danik solution

 Codeforces Round 379 (Div. 2) - 734 A. Anton and Danik solution

 

  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main() {
  5. #ifndef ONLINE_JUDGE
  6. freopen("input.txt", "r", stdin);
  7. freopen("output.txt", "w", stdout);
  8. #endif
  9. int n, anton=0, danik=0;
  10. char c;
  11. scanf("%d", &n);
  12. do {
  13. scanf("%c", &c);
  14. if(c=='A') anton++;
  15. else if(c=='D') danik++;
  16. } while(n--);
  17. if(anton<danik) printf("Danik\n");
  18. else if(danik<anton) printf("Anton\n");
  19. else printf("Friendship\n");
  20. //printf("Anton: %d, and Danik:%d.\n", anton, danik);
  21. return 0;
  22. }

 



No comments:

Post a Comment