-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10077.cpp
More file actions
37 lines (33 loc) · 743 Bytes
/
Copy path10077.cpp
File metadata and controls
37 lines (33 loc) · 743 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
#include <cstdio>
#include <cstring>
using namespace std;
int main(void)
{
int n, m, ln, lm, rn, rm, tn, tm;
double f, tf;
while (1) {
scanf("%d %d", &n, &m);
if (n == 1 && m == 1) break;
f = (double)n / m;
ln = rm = 0;
lm = rn = tn = tm = 1;
while (1) {
tf = (double)tn / tm;
if (tf < f) {
ln = tn;
lm = tm;
printf("R");
}else if (tf > f) {
rn = tn;
rm = tm;
printf("L");
}else{
printf("\n");
break;
}
tn = ln + rn;
tm = lm + rm;
}
}
return 0;
}