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

各路高手@ 此程序在编译器上是对的呀!! 而它说“Wrong Answer ”

Posted by sixshot at 2006-11-26 10:13:32 on Problem 1218
#include<stdio.h>

int main(){
    
    int i,j,k,x,sum[202],a[202],n[200],m;
    for(i=1;i<=101;i++){
        sum[i]=0;
    }
    scanf("%d",&x);
    for(i=1;i<=x;i++){
        scanf("%d",&n[i]);                                                                                                                                                                                                     
    }
    for(j=1;j<=x;j++){
        for(i=1;i<=n[j];i++){
            a[i]=1;
        }
                      
        for(i=1;i<=n[j];i++){
            m=1;
            k=m*i;
            while(k<=n[j]){
                
                if(a[k]==0)
                    a[k]=1;
                else
                    a[k]=0;
                m++;
                k=m*i;               
            }                           
        } 

           for(k=1;k<=n[j];k++){
               if(a[k]==0)
                 sum[j]++;
               else
                 continue;                       
           }                           
    }
    
    for(i=1;i<=x;i++)
        printf("%d\n",sum[i]);
        
    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