253A - Boys and Girls

  1. 253A - Boys and Girls
  2. #include<bits/stdc++.h>
  3. typedef long long int ll;
  4.  
  5. using namespace std;
  6. int main()
  7. {
  8.  
  9.  
  10. freopen("input.txt","r",stdin);
  11. freopen("output.txt","w",stdout);
  12. int n=0,m=0,i;
  13. scanf("%d %d",&n,&m);
  14.  
  15.  
  16. if(n>m){
  17. for( i=0;i<m;i++){
  18. printf("BG");
  19. }
  20.  
  21. for( i=0;i<n-m;i++)
  22. printf("B");
  23. }
  24. else{
  25. for( i=0;i<n;i++){
  26. printf("GB");
  27. }
  28. for( i=0;i<m-n;i++)
  29. printf("G");
  30. }
  31.  
  32. }

 

Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

Aptitude test assistant programmer 2018

1041A. Heist solution