题目传送门:http://www.spoj.com/problems/PEBBMOV/
同BZOJ_1982
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int MAXN = 100000+9; int arr[MAXN],n; inline int read(){ char c=getchar(); int ret=0; while (c<'0'||c>'9') c=getchar(); while (c<='9'&&c>='0') ret=ret*10+c-'0',c=getchar(); return ret; } int main(){ while (~scanf("%d",&n)) { for (int i=1;i<=n;i++) arr[i] = read(); sort(arr+1,arr+1+n); if (n%2) {cout<<"first player"<<endl; continue;} int tag = 1; for (int i=1;i<=n;i+=2) if (arr[i] != arr[i+1]) {cout<<"first player"<<endl; tag = 0; break;} if (tag) cout<<"second player"<<endl; } return 0; }
I just like the helpful info you supply for your articles. I will bookmark your weblog and test once more right here frequently. I am reasonably certain I will be informed a lot of new stuff right right here! Best of luck for the next!
You completed a number of fine points there. I did a search on the subject matter and found mainly people will agree with your blog.