Source Code
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
    int n, m;
    cin >> n >> m;

    ll k;
    cin >> k;

    ll total = 0;
    vector<int> a(n);
    for (int& x : a) {
        scanf("%d", &x);
        total += x;
    }

    ll weeks = (k - 1) / total;
    k -= weeks * total;

    int answer = 0;

    for (int i = 0; i <= n; i++) {
        if (k > 0 && k <= m) {
            answer++;
        }

        if (i < n) {
            k -= a[i];
        }
    }

    cout << answer << endl;
}
Copy
Treasure Baraa_Armoush
GNU G++17
0 ms
760 KB
Wrong Answer
Test Case #1
0 ms
360 KB
Accepted
Input
2 3 10
5 4
Output
1
Judge Output
1
Checker Message
"1"
Test Case #2
0 ms
400 KB
Accepted
Input
2 1 1
1 2
Output
1
Judge Output
1
Checker Message
"1"
Test Case #3
0 ms
616 KB
Accepted
Input
3 8 57
7 3 5
Output
2
Judge Output
2
Checker Message
"2"
Test Case #4
0 ms
736 KB
Accepted
Input
3 1000000000 1000000000000000000
1000000000 1000000000 1000000000
Output
1
Judge Output
1
Checker Message
"1"
Test Case #5
0 ms
752 KB
Accepted
Input
1 1 1
1
Output
1
Judge Output
1
Checker Message
"1"
Test Case #6
0 ms
728 KB
Accepted
Input
1 1000000000 1
1
Output
1
Judge Output
1
Checker Message
"1"
Test Case #7
0 ms
728 KB
Accepted
Input
1 1 1
1000000000
Output
1
Judge Output
1
Checker Message
"1"
Test Case #8
0 ms
732 KB
Accepted
Input
7 84 318122
2 90 24 32 87 54 61
Output
1
Judge Output
1
Checker Message
"1"
Test Case #9
0 ms
732 KB
Accepted
Input
7 84 318121
2 90 24 32 87 54 61
Output
1
Judge Output
1
Checker Message
"1"
Test Case #10
0 ms
744 KB
Accepted
Input
7 84 318123
2 90 24 32 87 54 61
Output
1
Judge Output
1
Checker Message
"1"
Test Case #11
0 ms
748 KB
Accepted
Input
10 5 200
2 7 8 3 8 4 8 5 7 10
Output
1
Judge Output
1
Checker Message
"1"
Test Case #12
0 ms
756 KB
Accepted
Input
15 5 200
7 7 4 2 1 2 6 2 6 6 10 6 8 5 9
Output
1
Judge Output
1
Checker Message
"1"
Test Case #13
0 ms
760 KB
Wrong Answer
Input
20 5 200
5 2 9 6 1 3 8 9 8 8 10 2 7 3 10 1 2 3 5 9
Output
0
Judge Output
1
Checker Message
1st words differ - expected: '1', found: '0'