-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBear_And_Candies_123.cpp
More file actions
39 lines (37 loc) · 914 Bytes
/
Bear_And_Candies_123.cpp
File metadata and controls
39 lines (37 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#define ll long long
#define f(end) for(int i=1;i<end;i++)
#define e '\n'
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t,a,b;
cin>>t;
while(t--)
{
cin>>a>>b;
bool ac=true,bc=false;
f(1000){
if(ac){
if(i>a){
cout<<"Bob"<<e;
break;
}
else a-=i;
}else{
if(i>b){
cout<<"Limak"<<e;
break;
}
else b-=i;
}
ac=!ac;
bc=!bc;
}
}
return 0;
}
// i used brute force to solve it like in one turn limak will eat then bob and so on
// for this i used bool variable to switch between limak and bob at the end of each iteration
// and checked if it is possible for the current person to eat it or not