답안 #487602

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
487602 2021-11-16T09:27:23 Z KazamaHoang Tarifa (COCI16_tarifa) C++14
50 / 50
1 ms 316 KB
#include <bits/stdc++.h>

using namespace std;

int n, x, a[105];

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> x >> n;
    for (int i = 1; i <= n; ++ i)
        cin >> a[i];
    int s = 0;
    for (int i = 1; i <= n; ++ i) {
        s += x;
        s = max(0, s - a[i]);
    }
    cout << s + x;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 316 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct