fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const string LIMAK = "Limak";
  5. const string BOB = "Bob";
  6. string findWinner(int maxL, int maxB){
  7. int totalL = 0, totalB = 0;
  8. int currL = 1, currB = 2;
  9. while(totalL < maxL || totalB < maxB){
  10. maxL-=currL;
  11. maxB-=currB;
  12. if(maxL >= 0){
  13. totalL+=currL;
  14. }
  15. if(maxB >= 0){
  16. totalB+=currB;
  17. }
  18. currL+=2;
  19. currB+=2;
  20. }
  21. if(totalB > totalL){
  22. return BOB;
  23. }
  24. return LIMAK;
  25. }
  26.  
  27. int main(){
  28. int test;
  29. scanf("%d", &test);
  30. while(test--){
  31.  
  32. int maxL, maxB;
  33. scanf("%d%d", &maxL, &maxB);
  34. cout<<findWinner(maxL, maxB)<<endl;
  35. }
  36. }
Success #stdin #stdout 0s 4504KB
stdin
10
3 2
4 2
1 1
1 2
1 3
9 3
9 11
9 12
9 1000
8 11
stdout
Bob
Limak
Limak
Bob
Bob
Limak
Limak
Bob
Bob
Bob