답안 #4053

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
4053 2013-08-31T16:07:30 Z shinhj88 King of penalty (kriii1_K) C++
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
long long int P,N;
vector<long long int> data;
void input()
{
	scanf("%lld%lld",&P,&N);
	data.resize(N+1);
	for(int i=0;i<N;i++)
	{
		scanf("%lld",&data[i]);
	}
	data[N]=100000001;
	sort(data.begin(),data.end());
	
}
void process()
{
	
	P--;
	long long int ans=0,sum=0;
	for(int i=0;i<=N;i++)
	{
		if(P-data[i]<=0)
		{
			printf("%d %lld\n",i,ans);
			break;
		}
		P-=data[i];
		ans+=P	
	}

	
}
int main()
{
	input();
	process();

}

Compilation message

K.cpp: In function 'void process()':
K.cpp:33:2: error: expected ';' before '}' token
K.cpp:23:22: warning: unused variable 'sum' [-Wunused-variable]
K.cpp: In function 'void input()':
K.cpp:9:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
K.cpp:13:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]