QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#188298 | #5491. Spidey Distance | IsaacMoris# | WA | 1ms | 3600kb | C++14 | 821b | 2023-09-25 18:34:40 | 2023-09-25 18:34:40 |
Judging History
answer
#include<iostream>
#include <bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e6 + 5, mod = 998244353;
void doWork() {
ll t, s;
cin >> t >> s;
ll ans1 = 1ll * (t + 1) * (t + 2) * 2 - (t + 1) * 4 + 1;
ll ans2 = 0;
for (ll x = 0; x <= s; x++) {
ans2 += min(x, (s - x) * 2) + 1;
ans2 += max(0ll, (2 * s - x) / 2 - x);
}
ans2 = ans2 * 4 - (s + 1) * 4 + 1;
ll g = __gcd(ans1, ans2);
if (ans1 >= ans2) {
cout << 1;
} else {
cout << ans1 / g << "/" << ans2 / g;
}
}
int main() {
IO
int t = 1;
//cin >> t;
for (int i = 1; i <= t; i++) {
// cout << "Case #" << i << ": ";
doWork();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3564kb
input:
4 4
output:
41/49
result:
ok single line: '41/49'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
6 6
output:
17/21
result:
ok single line: '17/21'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3436kb
input:
3 7
output:
25/141
result:
ok single line: '25/141'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3376kb
input:
7 3
output:
1
result:
ok single line: '1'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3384kb
input:
10 9
output:
221/229
result:
wrong answer 1st lines differ - expected: '209/229', found: '221/229'