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

请帮帮忙,是否逻辑错了?

Posted by 870817 at 2005-12-12 13:05:26 on Problem 1218
#include <stdio.h>
#include <math.h>
void main(){
	int i,j,k,l,n,count;
	int s[100]={-1};
	scanf("%d",&k);
	for(i=0;i<k;i++){
		count=0;
		scanf("%d",&n);
		for(j=1;j<=n;j++){
			for(l=0;l<n;l++){
				if((l+1)%j==0)
					s[l]=s[l]*(-1);
			}
		}
		for(l=0;l<n;l++){
			if(s[l]=1)
				count++;
		}
        printf("%d\n",count); 
	}
}

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