답안 #3535

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
3535 2013-08-31T06:26:31 Z hyeonjae0310 King of penalty (kriii1_K) C++
0 / 1
72 ms 2064 KB
#include <iostream>
#include <algorithm>

using namespace std;

int a[100000];

int main()
{
	int p,n;
	int i;
	int tot;
	cin>>p>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	tot=0;
	i=0;
	p--;
	while(p-a[i]>0)
	{
		tot+=p;
		p-=a[i];
		i++;
	}
	cout<<i<<' '<<tot;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2064 KB Output is correct
2 Correct 0 ms 2064 KB Output is correct
3 Correct 0 ms 2064 KB Output is correct
4 Correct 8 ms 2064 KB Output is correct
5 Correct 0 ms 2064 KB Output is correct
6 Correct 8 ms 2064 KB Output is correct
7 Correct 24 ms 2064 KB Output is correct
8 Correct 28 ms 2064 KB Output is correct
9 Incorrect 72 ms 2064 KB Output isn't correct
10 Halted 0 ms 0 KB -