QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#61552#1373. Rating ProblemsSilverhorse7#AC ✓4ms3728kbC++20487b2022-11-14 05:41:112022-11-14 05:41:12

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-14 05:41:12]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:3728kb
  • [2022-11-14 05:41:11]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N =2e5;
int a[N];
int n,k;

void Max(){
	for(int i = k ; i < n;i++)
		a[i]=3;
	double ans= 0;
	for(auto  i : a)
		ans+=i;
	ans/=n;
	cout<<fixed<<setprecision(9)<<ans;
}
void Min(){
	for(int i = k ; i < n;i++)
		a[i]=-3;
	double ans= 0;
	for(auto  i : a)
		ans+=i;
	ans/=n;
	cout<<fixed<<setprecision(9)<<ans<<endl;
} 
signed main(){
	cin>>n>>k;
	for(int i =  0 ; i < k; i++)
		cin>>a[i];
	Min(),Max();
}

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 3456kb

input:

10 0

output:

-3.000000000
3.000000000

result:

ok 2 numbers

Test #2:

score: 0
Accepted
time: 4ms
memory: 3604kb

input:

10 10
3
2
1
0
-1
-2
-3
-2
-1
0

output:

-0.300000000
-0.300000000

result:

ok 2 numbers

Test #3:

score: 0
Accepted
time: 3ms
memory: 3556kb

input:

10 10
0
0
0
0
0
0
0
0
0
0

output:

0.000000000
0.000000000

result:

ok 2 numbers

Test #4:

score: 0
Accepted
time: 3ms
memory: 3596kb

input:

10 10
3
3
3
3
3
3
3
3
3
3

output:

3.000000000
3.000000000

result:

ok 2 numbers

Test #5:

score: 0
Accepted
time: 3ms
memory: 3552kb

input:

10 10
-3
-3
-3
-3
-3
-3
-3
-3
-3
-3

output:

-3.000000000
-3.000000000

result:

ok 2 numbers

Test #6:

score: 0
Accepted
time: 2ms
memory: 3728kb

input:

1 0

output:

-3.000000000
3.000000000

result:

ok 2 numbers

Test #7:

score: 0
Accepted
time: 3ms
memory: 3608kb

input:

1 1
2

output:

2.000000000
2.000000000

result:

ok 2 numbers

Test #8:

score: 0
Accepted
time: 3ms
memory: 3608kb

input:

9 7
1
3
2
2
1
1
2

output:

0.666666667
2.000000000

result:

ok 2 numbers

Test #9:

score: 0
Accepted
time: 3ms
memory: 3456kb

input:

6 4
-2
-1
-2
0

output:

-1.833333333
0.166666667

result:

ok 2 numbers