Submission #1304797
Source Code Expand
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cstring> #include <cmath> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(0); string str1,str2,str3; cin >> str1 >> str2 >> str3; int l1=0,l2=0,l3=0; int k=0; int p=0; int ans=0; while(p==0) { if(l1==str1.length() && k==0) { p=1; ans=1; break; } else if(l2==str2.length() && k==1) { p=1; ans=2; break; } else if(l3==str3.length() && k==2) { p=1; ans=3; break; } if(k==0) { if(str1[l1]=='a') { l1++; } else if(str1[l1]=='b') { l1++; k=1; } else if(str1[l1]=='c') { l1++; k=2; } } else if(k==1) { if(str2[l2]=='a') { l2++; k=0; } else if(str2[l2]=='b') { l2++; } else if(str2[l2]=='c') { l2++; k=2; } } else if(k==2) { if(str3[l3]=='a') { l3++; k=0; } else if(str3[l3]=='b') { l3++; k=1; } else if(str3[l3]=='c') { l3++; } } // cout << k << ' ' << l1 << ' ' << l2 << ' ' << l3 << endl; } if(ans==1) { cout << "A" << endl; } else if(ans==2) { cout << "B" << endl; } else if(ans==3) { cout << "C" << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Card Game for Three (ABC Edit) |
User | horcrux2301 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1606 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 |