UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#200915#3476. mean155235975261002756ms16312kbC++11430b2024-01-14 10:57:322024-01-14 12:20:41

answer

#include <bits/stdc++.h>
#define ll long long
using namespace std ;
ll n , q , i , l , r , a[1000005] , f[1000005] ; 
int main(){
	ios::sync_with_stdio(false) ;
	cin.tie(nullptr) ;
	cout.tie(nullptr) ;
	cin >> n ;
	for(i=1;i<=n;i++){
		cin >> a[i] ;
		f[i] = f[i-1]+a[i] ;
	}
	cin >> q ;
	while(q--){
		cin >> l >> r ;
		printf("%lld\n",(ll)round((double)(f[r]-f[l-1])/(double)((r-l+1)*1.0))) ;
	}
	return 0 ;
}

详细

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

Test #1:

score: 10
Accepted
time: 70ms
memory: 13800kb

input:

802359
912719068 704515790 229260199 147592601 312951151 239675158 671289693 396533497 214225100 351...

output:

500564476
499469854
499621589
499456356
500030299
499936256
499191151
500273086
499556786
499729309
...

result:

ok 95 lines

Test #2:

score: 10
Accepted
time: 87ms
memory: 14648kb

input:

856789
436628446 522435140 886290426 371544486 140658028 264319851 246610314 849637492 481286113 457...

output:

498797399
499371543
499605175
499167743
499547676
498915341
499516905
499193992
499829931
499653481
...

result:

ok 89 lines

Test #3:

score: 10
Accepted
time: 143ms
memory: 16312kb

input:

963191
124823163 73711809 282792245 299624165 110213053 42689429 315009647 620344825 711634010 11772...

output:

500453327
500177494
500389225
499623736
498718041
499340052
505077424
500546239
499129066
499867309
...

result:

ok 94 lines

Test #4:

score: 10
Accepted
time: 386ms
memory: 1284kb

input:

976
414673811 380827949 420621127 325166534 694701737 14866736 322801732 174342675 467328763 1839471...

output:

508678795
500685551
474032862
480904247
492307446
516544445
466249421
490229404
523292575
507345263
...

result:

ok 863378 lines

Test #5:

score: 10
Accepted
time: 231ms
memory: 1284kb

input:

968
558399544 872858753 867775703 642101609 744642687 204662881 643698805 961699239 35971085 9926599...

output:

500358699
498820910
479586977
484673473
488465892
495508264
475098765
458782100
474987709
489947440
...

result:

ok 988402 lines

Test #6:

score: 10
Accepted
time: 204ms
memory: 1272kb

input:

853
379484167 282820618 974900180 531885211 180659147 389357480 376440629 621015893 53188913 7620274...

output:

527714076
511412344
526819205
492283093
519952403
505463613
479676128
510113599
524994315
506857449
...

result:

ok 892078 lines

Test #7:

score: 10
Accepted
time: 366ms
memory: 13772kb

input:

800448
915749806 986005732 843877066 839276179 942646467 440887278 238109891 237788490 336663914 741...

output:

500007117
502134664
500000808
499877067
499804988
500036440
500219877
500140555
500835287
499954446
...

result:

ok 862332 lines

Test #8:

score: 10
Accepted
time: 538ms
memory: 15484kb

input:

910020
409646942 798941054 986237048 952317339 744506356 253468691 250713874 951258324 251238795 162...

output:

499998355
498816258
498916881
499984440
500473751
497777599
500091170
499683782
499300019
499726509
...

result:

ok 928683 lines

Test #9:

score: 10
Accepted
time: 370ms
memory: 16296kb

input:

962278
437503795 746318731 650992126 517597648 62547645 363757627 50133504 879724484 256107080 90299...

output:

500320294
500368301
500072158
500294637
500320037
500449056
500303429
500245330
500452499
500363759
...

result:

ok 830036 lines

Test #10:

score: 10
Accepted
time: 361ms
memory: 14412kb

input:

841196
35003476 996569888 819223426 120265507 381282861 782983436 527480694 378886824 552555251 2067...

output:

500181511
499656736
499453473
500783583
500125194
500122342
500679402
499826895
499711059
500528750
...

result:

ok 831267 lines