- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- int f,n,p1=0,p2=0,c=-1;
- cin >> f >> n;
- int y,w[7]={5,-1,0,-1,-1,2};
- for (int i=0;i<n;i++){
- cin >> y;
- if (f == 0 && y == 2){
- p1 += 1;
- }
- else if (f == 0 && y == 5){
- p2 += 1;
- }
- else if (f == 2 && y == 5){
- p1 += 1;
- }
- else if (f == 2 && y == 0){
- p2 += 1;
- }
- else if (f == 5 && y == 0){
- p1 += 1;
- }
- else if (f == 5 && y == 2){
- p2 += 1;
- }
- cout << f << ' ';
- if (p1-p2 >= 1){
- cout << ": Won at round " << i+1 << endl;
- break;
- }
- if (p2-p1 >= 1){
- cout << ": Lost at round " << i+1 << endl;
- break;
- }
- if (p1 == p2 && i == n-1){
- cout << ": Drew at round " << n << endl;
- }
- if (c==y){
- f = w[y];
- }
- c = y;
- }
- return 0;
- }
複製代碼 |