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 ecjtuwh at 2006-12-28 11:20:45 on Problem 2247
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define pr printf
int qf(const void* a,const void *b)
{
    return *(int*)a-*(int*)b;
}
int main()
{
 int i,j,k,l,m,n,temp,t,s;
 double sum;
 int a[6000];
 temp=1;
 for (i = 0; i <= 30; i++)
  for (j = 0; j <= 19; j++)
	for (k = 0; k <= 13; k++)
	  for (l = 0; l <= 11; l++)
	   {
       sum=pow(2.0,(double)i)*pow(3.0,(double)j)*pow(5.0,(double)k)*pow(7.0,(double)l);
	   if (sum <= 2000000000) a[temp++]=int (sum);
	 }
qsort(a+1,temp,4,qf);

while(1)
{
scanf("%d",&n);if(n==0) break;
     if(n==1)pr("The 1st humble number is 1.\n");
else if(n==2)pr("The 2nd humble number is 2.\n");
else if(n==3)pr("The 3rd humble number is 3.\n");
else if(n%100==11||n%100==12||n%100==13) pr("The %dth humble number is %d.\n",n,a[n+1]);
else if(n%10==1)pr("The %dst humble number is %d.\n",n,a[n+1]);
else if(n%10==2)pr("The %dnd humble number is %d.\n",n,a[n+1]);
else if(n%10==3)pr("The %drd humble number is %d.\n",n,a[n+1]);
else pr("The %dth humble number is %d.\n",n,a[n+1]);
}    
}
  

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