#29506: help


a0955077720@gmail.com (陳丹尼)

School : No School
ID : 171273
IP address : [123.192.133.48]
Last Login :
2022-07-09 21:03:18
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [123.192.133.48] | Post Date : 2022-03-08 00:35

大神幫幫忙
看不出錯在哪
#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; }
 
#29519: Re:help


cges30901 (cges30901)

School : No School
ID : 30877
IP address : [39.9.76.177]
Last Login :
2022-08-14 16:16:23
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [27.247.9.93] | Post Date : 2022-03-08 19:01

		if(b==2){//scissor
	
		if(b==5){//paper
	


if改成else if

 
#29522: Re:help


a0955077720@gmail.com (陳丹尼)

School : No School
ID : 171273
IP address : [123.192.133.48]
Last Login :
2022-07-09 21:03:18
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [223.136.111.126] | Post Date : 2022-03-08 22:28

		if(b==2){//scissor
	
		if(b==5){//paper
	


if改成else if

對齁!謝謝你

 
ZeroJudge Forum