#29506: help


a0955077720@gmail.com (陳丹尼)

學校 : 不指定學校
編號 : 171273
來源 : [163.13.226.107]
最後登入時間 :
2023-05-03 08:44:50
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [123.192.133.48] | 發表日期 : 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)

學校 : 不指定學校
編號 : 30877
來源 : [101.136.203.77]
最後登入時間 :
2024-04-07 15:34:14
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [27.247.9.93] | 發表日期 : 2022-03-08 19:01

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


if改成else if

 
#29522: Re:help


a0955077720@gmail.com (陳丹尼)

學校 : 不指定學校
編號 : 171273
來源 : [163.13.226.107]
最後登入時間 :
2023-05-03 08:44:50
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [223.136.111.126] | 發表日期 : 2022-03-08 22:28

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


if改成else if

對齁!謝謝你

 
ZeroJudge Forum