UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#200920#3476. meanqiuqiu1002645ms16204kbC++11794b2024-01-14 10:58:362024-01-14 12:22:12

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define m_p make_pair
#define t_s to_string
#define t_ll stoll
#define B break;
#define C continue;
#define R(x) return x;
#define K exit(0);
#define W while
#define F for
#define E else
#define I if
#define EI else if
#define G(x) x=rd();
#define P printf
#define __lcm(a,b) (a/__gcd(a,b)*b)
int rd(){
	int x=0,f=1,ch=getchar();
	W(ch<'0'||ch>'9'){
		I(ch=='-') f=-1;
		ch=getchar();
	}
	W(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	R(x*f)
}
int arr[long(2e6)],qzh[long(2e6)];
signed main()
{
	int x,q,l,r;
	G(x)
	F(int i=1;i<=x;i++){G(arr[i])qzh[i]=arr[i]+qzh[i-1];}
	G(q)F(int i=1;i<=q;i++){
		G(l)G(r)P("%lld\n",(long long)((qzh[r]-qzh[l-1])*1.0/(r-l+1)+0.5));
	}
	R(0)
}

Details

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

Test #1:

score: 10
Accepted
time: 106ms
memory: 13688kb

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: 109ms
memory: 14536kb

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: 117ms
memory: 16204kb

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: 259ms
memory: 1164kb

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: 157ms
memory: 1164kb

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: 272ms
memory: 1164kb

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: 367ms
memory: 13656kb

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: 539ms
memory: 15372kb

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: 431ms
memory: 16184kb

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: 288ms
memory: 14292kb

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