Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
159086 王润中 【数组】猴子选大王(monkey) C++ Wrong Answer 1 MS 264 KB 594 2026-08-25 17:36:48

Tests(0/4):


Code:

#include <iostream> #include <cmath> using namespace std; #define N 10005 bool a[N]; int main(){ int n,len,s; cin>>n,len=n; while(len>=2){ s=0; for(int i=1;i<=n;i++){ if(a[i]==false){ s++; } if(s==3){ a[i]=true; s=0; len--; } s=0; for(int i=n;i>=1;i--){ if(a[i]==false){ s++; } if(len==2&&s==1){ cout<<i<<endl; return 0; } if(s==3){ a[i]=true; s=0; len--; } } } } }


Run Info:

------Input------
255
------Answer-----
151
------Your output-----
255