QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#580829 | #9381. 502 Bad Gateway | ucup-team1769 | WA | 316ms | 3616kb | C++20 | 951b | 2024-09-22 00:13:55 | 2024-09-22 00:13:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
const int mod = 998244353;
struct node // 分数
{
int a, b;
node() {}
node(int a, int b) : a(a), b(b) {}
// 乘法
node operator*(const node &x) const
{
return {a * x.a, b * x.b};
}
// 加法
node operator+(const node &x) const
{
if (b == 0)
return x;
if (x.b == 0)
return *this;
return {a * x.b + x.a * b, b * x.b};
}
// 约分
void reduce()
{
int g = __gcd(a, b);
a /= g;
b /= g;
}
} a;
void solve()
{
int n;
cin >> n;
a = {n * (n + 1) / 2, n};
a.reduce();
cout << a.a << " " << a.b << endl;
}
signed main()
{
cin.tie(0)->ios::sync_with_stdio(false);
int t = 1;
cin >> t;
while (t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 316ms
memory: 3616kb
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 1000000001 2 1 1 1 1 1000000001 2 1 1 1000000001 2 1 1 1 1 1 1 1000000001 2 1 1 1 1 1000000001 2 1 1 1000000001 2 1000000001 2 1 1 1000000001 2 1 1 1 1 1000000001 2 1 1 1000000001 2 1000000001 2 1 1 1000000001 2 1000000001 2 1000000001 2 1000000001 2 1000000001 2 1000000001 2 1 1 1 1 1000000001 ...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '1000000001 2'