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 Sempr at 2007-02-01 20:31:16 on Problem 1338
In Reply To:诡异的事情下面的程序c可以AC,用gcc就WA Posted by:miao at 2007-02-01 20:28:32
> #include <stdio.h>
> #include <math.h>
> 
> 
> int
> cmp(const void *p,const void *q)
> {
>         return *(int *)p - *(int *)q;
> }
> 
> int
> main()
> {
>         int i,n,m,i1,i2,i3;
>         int a[6000];
>         i = 0;
>         for(i1 = 0; i1 < 32; i1++)
>                 for(i2 = 0 ;i2 < 21; i2++)
>                         for(i3 = 0; i3 < 15; i3++)
>                                 if(pow(2,i1)*pow(3,i2)*pow(5,i3) < 2100000000.0){
>                                                 a[i++] = pow(2,i1)*pow(3,i2)*pow(5,i3);
>                                 }
>         qsort(a,i,sizeof(a[0]),cmp);
>         while(scanf("%d",&n) == 1 && n != 0){
>                 printf("%d\n",a[n-1]);
>         }
>         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