QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#588000 | #9381. 502 Bad Gateway | roufubo | WA | 118ms | 3808kb | C++14 | 567b | 2024-09-24 23:26:05 | 2024-09-24 23:26:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t;
ll gcd(ll a, ll b) {
if (b == 0)return a;
return gcd(b, a % b);
}
void solve() {
scanf("%lld", &t);
if (t == 1)printf("1 1\n");
else if (t == 2)printf("3 2\n");
else if (t == 3)printf("2 1\n");
else {
ll z = (t + 1) / 2 ;
ll h = t - z;
ll fz = (1 + z) * z / 2 + h;
ll fm = t - h;
ll gcds = gcd(fz, fm);
fz /= gcds, fm /= gcds;
printf("%lld %lld\n", fz, fm);
}
}
int main() {
int T;
scanf("%d", &T);
while (T--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3768kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 118ms
memory: 3808kb
input:
1000000 1 1000000000 1 1 1000000000 1 1000000000 1 1 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1 1000000000 1 1000000000 1000000000 1000000000 1000000000 1 1 1 10000000...
output:
1 1 500000003 2 1 1 1 1 500000003 2 1 1 500000003 2 1 1 1 1 1 1 500000003 2 1 1 1 1 500000003 2 1 1 500000003 2 500000003 2 1 1 500000003 2 1 1 1 1 500000003 2 1 1 500000003 2 500000003 2 1 1 500000003 2 500000003 2 500000003 2 500000003 2 500000003 2 500000003 2 1 1 1 1 500000003 2 1 1 500000003 2 ...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '500000003 2'