UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213026#3824. 最大公约数drdilyor50318ms1164kbC++11631b2024-11-03 12:16:492024-11-03 13:02:02

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
void ts(){cout<<"IAKIOI\n";}
inline int read(){
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
void solve(){
	int n=read();
	if(n&1){cout<<0<<"\n";return;}
	if(n<=100000){
		unsigned int res=0;
		for(int i=0;i<=n;i++){
			int x=__gcd(n,i);
			if(i&1)res-=x;
			else res+=x;
		}
		cout<<res<<"\n";return;
	}
}
signed main(){
	int t=read();
	while(t--)solve();
	return 0;
}
//look at my code
//my code is amazing

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 111ms
memory: 1160kb

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: 108ms
memory: 1156kb

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: 99ms
memory: 1160kb

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: 1160kb

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: 1164kb

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: 1120kb

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: 1116kb

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: 1120kb

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: 1120kb

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: 1120kb

input:

10
792907836240
851587632744
993304166400
507384285600
873921498624
866248782720
697501279180
813957...

output:


result:

wrong answer 1st lines differ - expected: '36894114384240', found: ''