Created
July 26, 2019 09:29
-
-
Save surinoel/3cd243908f6396b1680f69779252f428 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <vector> | |
| #include <iostream> | |
| using namespace std; | |
| int main(void) { | |
| ios_base::sync_with_stdio(false); | |
| cin.tie(nullptr); | |
| int k, n; | |
| int time = 210; // 3분 30초 | |
| cin >> k >> n; | |
| vector<int> a = { 1, 2, 3, 4, 5, 6, 7, 8 }; | |
| k -= 1; // 실제 인덱스에 접근하려면 -1 | |
| for (int i = 0; i < n; i++) { | |
| int t; | |
| char c; | |
| cin >> t >> c; | |
| if (time - t <= 0) { // 폭탄 대상이라면 | |
| cout << a[k] << '\n'; | |
| break; | |
| } | |
| time -= t; | |
| if (c == 'T') { // 정답을 맞췄다면 | |
| if (++k == 8) k = 0; | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment