Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请帮帮忙,是否逻辑错了?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator