Submission #1381815
Source Code Expand
#define _USE_MATH_DEFINES // for C++ #include <cmath> #include <iostream> #include <iomanip> #include <string> #include <vector> #include <algorithm> #include <array> #include <iterator> #include <utility> #include <set> #include <random> #include <map> #include <stack> #include <queue> #include <list> #include <functional> #include <bitset> #define LL long long #define NUM 1000000007 using namespace std; int main() { char next, win; string sa, sb, sc; cin >> sa >> sb >> sc; for (size_t count = 0;; count++) { if (count == 0) { next = sa.front(); sa.erase(sa.begin()); } else { if (next == 'a' && sa.empty()) { win = 'A'; break; } else if (next == 'b' && sb.empty()) { win = 'B'; break; } else if (next == 'c' && sc.empty()) { win = 'C'; break; } if (next == 'a') { next = sa.front(); sa.erase(sa.begin()); } else if (next == 'b') { next = sb.front(); sb.erase(sb.begin()); } else { next = sc.front(); sc.erase(sc.begin()); } } } cout << win << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Card Game for Three (ABC Edit) |
User | poketorena |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1541 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||
---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||
Status | AC |
|
Set Name | Test Cases |
---|---|
Sample | |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample_01.txt, sample_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | AC | 1 ms | 256 KB |
07.txt | AC | 1 ms | 256 KB |
08.txt | AC | 1 ms | 256 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 1 ms | 256 KB |
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |