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

wrongcode. 有心情了再回来调

Posted by qiqilrq at 2007-10-25 22:03:27 on Problem 3423
#include<stdio.h>
#include<stdlib.h>

int S,N;
int idx[2100];

long long f2f(int n){//find 2 factor
    //printf("f2f %d",n);
    long long cnt=0;
    do
    {
        n/=2;
        cnt+=n;
    }while(n>1);
    //printf(" %d\n",cnt);
    return cnt;
}
//even, 0; odd, 1
int eoo(int id){
    if(1&(id+S)==0||id>=S) return 0;
    int n=S-1;
    int k=(id+n)/2;
    //printf("n=%d k=%d ret=%d\n",n,k,f2f(n)==f2f(k)+f2f(n-k));
    return f2f(n)==f2f(k)+f2f(n-k);
}

int solve(int si){
    int ret=0,i;
    for(i=0;i<N;i++)
        ret = (ret + eoo( abs(si-idx[i]))) & 1;
    return ret;
}
 
int main()
{
	int F,L,i,j;
	scanf("%d",&N);
	for(i=0;i<N;i++)
        scanf("%d",idx+i);
	scanf("%d%d%d",&S,&F,&L);
	for(i=0;i<L;i++)
	    printf("%d\n", solve(i+F));
	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