Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define fto(i, l, r) for (int i=l; i<=r; ++i)
- using namespace std;
- int start, n, a[10];
- bool found = false;
- int main() {
- #ifndef ONLINE_JUDGE
- freopen("P141PROA.inp", "r", stdin);
- #endif // ONLINE_JUDGE
- scanf("%d%d", &start, &n);
- memset(a, 0, sizeof a);
- while (n--)
- {
- int time; char ans;
- scanf("%d %c", &time, &ans);
- a[start] += time;
- if (a[start] > 210)
- {
- printf("%d\n", start);
- found = true;
- break;
- }
- if (ans == 'T')
- {
- ++start;
- if (start > 8)
- {
- start = 1;
- a[1] = a[8];
- }
- else a[start] += a[start - 1];
- }
- //fto(i, 1, 8) cout << a[i] << " "; cout << endl;
- }
- if (!found) printf("%d", start);
- //fto(i, 1, 8) cout << a[i] << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement