Skip to content

Commit 2b06b08

Browse files
committed
solved 3652
1 parent 3d14372 commit 2b06b08

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

3000/3652/3652.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int a, b;
5+
char t;
6+
7+
int gcd(int a, int b){
8+
if(b == 0) return a;
9+
return gcd(b, a%b);
10+
}
11+
12+
void solve(int a, int b){
13+
int g = gcd(a, b);
14+
a /= g;
15+
b /= g;
16+
17+
if(a==1 && b==1) return;
18+
19+
if(a > b){
20+
cout<<"R";
21+
solve(b, a-b);
22+
} else{
23+
cout<<"L";
24+
solve(b-a, a);
25+
}
26+
}
27+
28+
int main() {
29+
ios::sync_with_stdio(false); cin.tie(NULL);
30+
cin>>a>>t>>b;
31+
solve(a, b);
32+
33+
return 0;
34+
}

0 commit comments

Comments
 (0)