#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |