QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#650178 | #4771. Bird tree | SGColin# | AC ✓ | 1ms | 3700kb | C++20 | 818b | 2024-10-18 13:42:34 | 2024-10-18 13:42:35 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef __int128 lll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
inline int rd() {
int x = 0;
bool f = 0;
char c = getchar();
for (; !isdigit(c); c = getchar()) f |= (c == '-');
for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
return f ? -x : x;
}
#define eb emplace_back
#define all(s) (s).begin(), (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
inline void work() {
int a = rd(), b = rd();
while (a != b) {
if (a < b) {putchar('L'); b -= a; swap(a, b);}
else {putchar('R'); a -= b; swap(a, b);}
}
puts("");
}
int main() {
per(t, rd(), 1) work();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
input:
3 1/2 2/5 7/3
output:
L LRR RLLR
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
96 1/2 1/3 1/4 1/5 1/6 1/7 1/8 2/1 2/3 2/5 2/7 3/1 3/2 3/4 3/5 3/7 3/8 4/1 4/3 4/5 4/7 5/1 5/2 5/3 5/4 5/6 5/7 5/8 6/1 6/5 6/7 7/1 7/2 7/3 7/4 7/5 7/6 7/8 8/1 8/3 8/5 8/7 10000/9999 9999/10000 1/10000 10000/1 1000000000/300001 300001/1000000000 701408733/433494437 433494437/701408733 380211999/53852...
output:
L LR LRL LRLR LRLRL LRLRLR LRLRLRL R LL LRR LRLL RL RR LLR LLL LRRL LRRR RLR RRL LLRL LLLR RLRL RLL RRR RRLR LLRLR LLRR LLLL RLRLR RRLRL LLRLRL RLRLRL RLRR RLLR RRRL RRLL RRLRLR LLRLRLR RLRLRLR RLLL RRRR RRLRLRL RRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...
result:
ok 96 lines