Codeforces Round #154 (Div. 2) A. Boys and Girls

本是古典 何须时尚 2021-12-24 08:59 256阅读 0赞

题目:http://codeforces.com/problemset/problem/253/A

男女排队,男生多则男生站第一位 vice versa

  1. #include <iostream>
  2. #include <stdio.h>
  3. using namespace std;
  4. int main()
  5. {
  6. freopen("input.txt","r",stdin);
  7. freopen("output.txt","w",stdout);
  8. int n,m;
  9. cin>>n>>m;
  10. if(n>=m)
  11. {
  12. for(int i=0;i<m;i++)
  13. {
  14. cout<<"BG";
  15. }
  16. for(int i=0;i<n-m;i++)
  17. {
  18. cout<<"B";
  19. }
  20. }
  21. else
  22. {
  23. for(int i=0;i<n;i++)
  24. {
  25. cout<<"GB";
  26. }
  27. for(int i;i<m-n;i++)
  28. {
  29. cout<<"G";
  30. }
  31. }
  32. return 0;
  33. }

转载于:https://www.cnblogs.com/danielqiu/archive/2013/01/17/2865140.html

发表评论

表情:
评论列表 (有 0 条评论,256人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Codeforces Round #556 (Div. 2) A

    题面很简单,思路就是简单贪心,si数组是贮存购买数组,bi数组是贮存出售数组,题面是给你r的货币,让你通过出售和购买来获取最大价值,第一种算法是通过找出bi数组最大值,和si数