QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#580423 | #9381. 502 Bad Gateway | xinlengweishang | WA | 0ms | 3932kb | C++20 | 497b | 2024-09-21 21:49:46 | 2024-09-21 21:49:46 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) {
return b ? gcd(b, a % b) : a;
}
int main() {
int T;
scanf("%d", &T);
while (T--) {
ll n;
cin>>n;
ll x=(ll)(sqrt(2*n+0.25)-1/2);
while(((x+1)*(x+2))/2<=n) x++;
// printf("%lld ",x);
n-=((x)*(x+1))/2;
// printf("%lld\n",n);
ll fenzi=x*(x+1)+n;
ll fenmu=x+1;
printf("%lld %lld\n",fenzi/gcd(fenzi,fenmu),fenmu/gcd(fenzi,fenmu));
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3932kb
input:
3 1 2 3
output:
1 1 5 3 2 1
result:
wrong answer 2nd lines differ - expected: '3 2', found: '5 3'