三个人 比赛,两个人下棋 一个人旁观,下棋之后输的人去旁观,胜的人和之前旁观的人比赛下棋 。模拟下就可以了
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int ans=3; for(int i=0; i<n; ++i) { int x; cin>>x; if(x==ans) { cout<<"NO "; return 0; } ans=6-x-ans; } cout<<"YES "; return 0; }
模拟下就可以了啊
#include<stdio.h> int main() { int a2[15]={1,2,4,8,16,32,64,128,256,512,1024}; int a[15],i,n; for(i=1;i<10;i++) a[i]=(a2[i]-1)*a2[i-1]; scanf("%d",&n); for(i=9;i>=1;i--) { if(n%a[i]==0) { printf("%d ",a[i]); break; } } return 0; }