Benelux Algorithm Programming Contest 2016 Preliminary

A. Block Game

 1 #pragma GCC optimize(2)
 2 #include <bits/stdc++.h>
 3 #define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 4 #define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
 5 #define pb push_back
 6 #define all(x) x.begin(),x.end()
 7 #define fs first
 8 #define sc second
 9 using namespace std;
10 typedef long long ll;
11 typedef unsigned long long ull;
12 typedef pair<int,int> pii;
13 const int maxn = 1e6+10;
14 const int maxM = 1e6+10;
15 const int inf = 0x3f3f3f3f;
16 const ll inf2 = 0x3f3f3f3f3f3f3f3f;
17 inline void read(int &x){
18     int s=0,w=1;
19     char ch=getchar();
20     while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
21     while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
22     x = s*w;
23 }
24 
25 ll x,y;
26 bool dfs(ll x,ll y){
27     if(x < y) swap(x,y);
28     if(x == 0 || y == 0) return false;
29     if(!dfs(y,x%y) || x / y >1) return true;
30     return false;
31 }    
32 int main(){
33     // debug;
34     ios;
35 
36     cin>>x>>y;
37     if(dfs(x,y)) cout<<"win\n";
38     else cout<<"lose\n";
39     
40     return 0;
41 }

 

 

posted @ 2020-09-05 21:26  yya雨  阅读(228)  评论(0编辑  收藏  举报