Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Nim 加枚举 可能速度慢了一点 50T 留念

Posted by io07 at 2014-05-06 17:12:02 on Problem 2975
//poj 2068
//Nim
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <queue>

using namespace std;
#define SIZE 1005
#define INF 10000000

int main()
{
    int N;
    long long a[SIZE],sum,res;
    while(scanf("%d",&N),N){
        for(int i=0;i<N;i++) scanf("%lld",&a[i]);
        res=0;
        for(int i=0;i<N;i++){
            sum=0;
            for(int j=0;j<N;j++){
                if(j==i) continue;
                sum^=a[j];
            }
            if(a[i]-sum>0) res++;
        }
        printf("%lld\n",res);
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator