제출 #113279

#제출 시각아이디문제언어결과실행 시간메모리
113279CaQtimlTarifa (COCI16_tarifa)C++14
50 / 50
2 ms384 KiB
#include "bits/stdc++.h"
using namespace std;
int arr[120];
int main()
{
	int n;
	cin >> n;
	int rob;
	cin >> rob;
	int now=n;
	for(int i=1;i<=rob;i++)
	{
		int op;
		cin >> op;
		if(now-op>=0)
		{
			now-=op;
			now+=n;
		}
		else
		{
			cout << now;
			exit(0);
		}
	}
	cout << now;
}
#Verdict Execution timeMemoryGrader output
Fetching results...