Submission #123246


Source Code Expand

Copy
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	
	int rate[N];
	for(int i = 0; i < N; i++){
		cin >> rate[i];
	}

	sort(rate, rate + N);

	double Trate = 0.0;
	for(int i = 0; i < K; i++){
		if(K == N)	Trate = (Trate + rate[i]) / 2.0;
		else	Trate = (Trate + rate[K + i]) / 2.0;
	}

	printf("%.6f\n", Trate);

	return 0;
}

Submission Info

Submission Time
Task C - AtCoderプログラミング講座
User kene
Language C++ (G++ 4.6.4)
Score 0
Code Size 402 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:23:24: error: ‘printf’ was not declared in this scope