ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#213022 | #3824. 最大公约数 | shiruiheng | 50 | 297ms | 1196kb | C++11 | 639b | 2024-11-03 08:43:57 | 2024-11-03 13:01:36 |
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
//using LL = __int128
#define pi pair<ll, ll>
#define fi first
#define se second
//#define fi(x) (x->first)
//#define se(x) (x->second)
ll n, t;
void solve(){
unsigned long long ans = 0, tmp = -1;
for(int i = 0 ; i <= n ; i++){
ans += (tmp *= -1) * __gcd(n, 1ll * i);
}
cout << ans << "\n";
}
int main(){
cin >> t;
while(t--){
cin >> n;
if(n <= 100000){
solve();
continue;
}
if(n % 2 == 1){
cout << 0 << "\n";
continue;
}
}
return 0;
}
/*
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
*/
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 104ms
memory: 1192kb
input:
10 54926 90288 81440 67894 64722 61170 95256 94752 59904 98368
output:
162827 2104272 813680 202699 453747 244635 1775844 2125872 1269504 1247488
result:
ok 10 lines
Test #2:
score: 10
Accepted
time: 99ms
memory: 1196kb
input:
10 64000 76328 56400 75540 89808 72566 71682 57048 89460 99316
output:
1043200 903284 1023600 528600 688368 212091 301307 342228 1475208 468152
result:
ok 10 lines
Test #3:
score: 10
Accepted
time: 94ms
memory: 1192kb
input:
10 80310 74048 68070 50202 75380 59528 84544 84640 55440 61056
output:
321195 923648 272235 167319 346712 391028 591616 1194160 1706544 1048896
result:
ok 10 lines
Test #4:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
10 449813415219 238127986797 141941948583 570931177507 599551449147 107803513771 877967309187 390005...
output:
0 0 0 0 0 0 0 0 0 0
result:
ok 10 lines
Test #5:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
10 10384276147 991130530443 376705130467 176660198029 71835888101 243351181691 106856013219 60580750...
output:
0 0 0 0 0 0 0 0 0 0
result:
ok 10 lines
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 1156kb
input:
10 873655567624 887745378432 579208100112 627322249728 674458211840 831871918080 671762267568 957053...
output:
result:
wrong answer 1st lines differ - expected: '19876945147444', found: ''
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 1152kb
input:
10 588091392000 526120252000 785151270000 960505337304 890742975972 536233040000 611974995856 541092...
output:
result:
wrong answer 1st lines differ - expected: '255078254592000', found: ''
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 1152kb
input:
10 884417667840 852117801984 871881667200 551138972160 644606815160 907614111040 557989228800 917485...
output:
result:
wrong answer 1st lines differ - expected: '496472754435840', found: ''
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 1152kb
input:
10 830832396800 727006448672 696814829568 608595958080 765299682306 822293683200 990128124000 833599...
output:
result:
wrong answer 1st lines differ - expected: '105081605000960', found: ''
Test #10:
score: 0
Wrong Answer
time: 0ms
memory: 1152kb
input:
10 792907836240 851587632744 993304166400 507384285600 873921498624 866248782720 697501279180 813957...
output:
result:
wrong answer 1st lines differ - expected: '36894114384240', found: ''