QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#178364 | #5503. Euclidean Algorithm | real_sigma_team# | TL | 0ms | 3380kb | C++20 | 673b | 2023-09-13 21:42:34 | 2023-09-13 21:42:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using ll = long long;
const int N = 3e5 + 5;
void solve() {
ll n;
cin >> n;
ll ans = 0;
for (ll x = 1; x <= n; ++x) {
for (ll y = x + 1; y <= n; ++y) {
if ((y - gcd(x, y)) % (y - x) == 0) {
ans++;
}
}
}
cout << ans << '\n';
}
int main() {
#ifndef LOCAL
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#else
freopen("input.txt", "r", stdin);
#endif
int t;
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: 3380kb
input:
3 2 5 14
output:
1 9 62
result:
ok 3 lines
Test #2:
score: -100
Time Limit Exceeded
input:
3 29107867360 65171672278 41641960535