QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#585396 | #9381. 502 Bad Gateway | littTang | WA | 315ms | 3708kb | C++23 | 952b | 2024-09-23 20:38:12 | 2024-09-23 20:38:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define lson (p << 1)
#define rson (p << 1 | 1)
#define lowbit(x) x & -x
#define PII pair<int, int>
#define B 30
const int maxn = 1e2 + 10;
const int maxm = 2e5 + 10;
const int mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const int lINF = 0x3f3f3f3f3f3f3f3f;
void solve(){
int t;
cin >> t;
int c1 = floor(sqrt(2.0 * t));
int c2 = ceill(sqrt(2.0 * t));
if((1.0 * (c1 * c1 - c1 + 2 * t) / (2.0 * c1)) < (1.0 * (c2 * c2 - c2 + 2 * t) / (2.0 * c2))){
int x = c1 * c2 - c1 + 2 * t;
int y = 2 * c1;
int d = __gcd(x, y);
cout << x / d << " " << y / d << endl;
}
else{
int x = c2 * c2 - c2 + 2 * t;
int y = 2 * c2;
int d = __gcd(x, y);
cout << x / d << " " << y / d << endl;
}
}
signed main(){
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 1;
cin >> T;
while(T--)
{
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 315ms
memory: 3708kb
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 3999967841 89442 1 1 1 1 3999967841 89442 1 1 3999967841 89442 1 1 1 1 1 1 3999967841 89442 1 1 1 1 3999967841 89442 1 1 3999967841 89442 3999967841 89442 1 1 3999967841 89442 1 1 1 1 3999967841 89442 1 1 3999967841 89442 3999967841 89442 1 1 3999967841 89442 3999967841 89442 3999967841 89442 39...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '3999967841 89442'