#35158:


shane950517@gmail.com (ㄟ不是)

學校 : 國立臺中高級工業職業學校
編號 : 166971
來源 : [60.249.14.165]
最後登入時間 :
2024-02-28 10:14:56
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [122.118.49.183] | 發表日期 : 2023-05-13 15:04

 
#include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, x[12], y[12];
cin >> x[1];                     
cin >> n;              
for (int i = 1; i <= n; i++)
{
cin >> y[i];
}
for (int i = 2; i <= n; i++) 
{
if (i >= 3 && y[i - 2] == y[i - 1])
{
if (y[i - 1] == 0) x[i] = 5;
if (y[i - 1] == 2) x[i] = 0;
if (y[i - 1] == 5) x[i] = 2;
}
else
{
x[i] = y[i - 1];                
}
}
bool finished = false;
for(int i = 1; i<=n; i++)
{
cout << x[i] << ' ';
if (x[i] != y[i])
{
int d = x[i] - y[i];
if (d == 5 || d == -2 || d == -3)
{
cout << ": Won at round " << i << '\n';
 
}
else 
{
cout << ": Lost at round " << i << '\n';
 
}
finished = true;
break;
}
}
if (!finished) 
{
cout << ": Drew at round " << n << '\n';
}
}
 
 
 
 
 
ZeroJudge Forum