| ||||||||||
| 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 | |||||||||
呵呵,数据不能保证把你的全部错误都测试出来的In Reply To:这是我的疑问 Posted by:acm1985 at 2006-04-28 11:23:42 > #include<stdio.h>
> #include<math.h>
> int main()
> {
> int n,c,num,i,j;
> while(scanf("%d%d",&n,&c)!=EOF)
> {
> int arry[1001]={0};
> if(n==1)
> {
> printf("%d %d: 1\n\n",n,c);
> continue;
> }
> num=0;
> for(i=2;i<=sqrt(n);i++)
> for(j=i*2;j<=n;j++)
> if((j%i==0)&&(arry[j]==0))
> {
> arry[j]=1;
> num++;
> }
> num=n-num;
> i=0;
> for(j=1;j<=n;j++)
> if(arry[j]==0)
> arry[++i]=j;
> printf("%d %d:",n,c);
> if(c>=num)
> for(i=1;i<=num;i++)
> printf(" %d",arry[i]);
> else if(num%2==0)
> for(i=num/2-c+1;i<=num/2+c;i++)
> printf(" %d",arry[i]);
> else if(num%2==1)
> for(i=num/2-c+2;i<=num/2+c;i++)
> printf(" %d",arry[i]);
> printf("\n\n");
> }
> return 0;
> }
> 这个程序提交是AC的
> 但是输入 21 6
> 类似的数的话
> 结果是
> 0 1 2 3 5 7 11 13 17 19 1
> 结果不对啊
> 怎么还能AC呢?????
> 疑问中
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator