大神幫幫忙
看不出錯在哪
#include<bits/stdc++.h> using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int count=0; int b,n; cin>>b>>n; int s[n]; for(int i=1;i<=n;i++){ cin>>s[i]; } for(int i=1;i<=n;i++){ if(b==0){//stone if(s[i]==2){//scissor cout<<b<<" : Won at round "<<i<<"\n"; count=0; break; } if(s[i]==5){//paper cout<<b<<" : Lost at round "<<i<<"\n"; count=0; break; } if(s[i]==0){ cout<<b<<" "; count++; if(count==n){ cout<<": Drew at round "<<i<<"\n"; count=0; break; }else if(count%2==0){ b=5; }else if(count%2!=0){ b=0; } } } if(b==2){//scissor if(s[i]==5){//paper cout<<b<<" : Won at round "<<i<<"\n"; count=0; break; } if(s[i]==0){//stone cout<<b<<" : Lost at round "<<i<<"\n"; count=0; break; } if(s[i]==2){ cout<<b<<" "; count++; if(count==n){ cout<<": Drew at round "<<i<<"\n"; count=0; break; }else if(count%2==0){ b=0; }else if(count%2!=0){ b=2; } } } if(b==5){//paper if(s[i]==0){//stone cout<<b<<" : Won at round "<<i<<"\n";\ count=0; break; } if(s[i]==2){//scissor cout<<b<<" : Lost at round "<<i<<"\n"; count=0; break; } if(s[i]==5){ cout<<b<<" "; count++; if(count==n){ cout<<": Drew at round "<<i<<"\n"; count=0; break; }else if(count%2==0){ b=2; }else if(count%2!=0){ b=5; } } } } return 0; }
if(b==2){//scissor if(b==5){//paper
if改成else if
if(b==2){//scissor if(b==5){//paper
if改成else if
對齁!謝謝你