POJ 2247 Humble Numbers
来源:互联网 发布:微博域名怎么改 编辑:程序博客网 时间:2024/04/29 18:30
做了好多遍,竟然做到一半不会了,郁闷!
#include<stdio.h>
#include<string.h>
int min(int a,int b)
{
return a>b?b:a;
}
int main()
{
int num[6000],s,i,j,k,l,n;
num[1]=1;i=j=k=l=1;
for(s=2;s<=5850;s++)
{
num[s]=min(num[i]*2,min(num[j]*3,min(num[k]*5,num[l]*7)));
if(num[s]==num[i]*2)
i++;
if(num[s]==num[j]*3)
j++;
if(num[s]==num[k]*5)
k++;
if(num[s]==num[l]*7)
l++;
}
while(scanf("%d",&n),n!=0)
{
if(n==1&&n0!=11)
printf("The %dst humble number is %d.\n",n,num[n]);
else if(n==2&&n0!=12)
printf("The %dnd humble number is %d.\n",n,num[n]);
else if(n==3&&n0!=13)
printf("The %drd humble number is %d.\n",n,num[n]);
else printf("The %dth humble number is %d.\n",n,num[n]);
}
return 0;
}
- POJ 2247 Humble Numbers
- HDU 1058 Humble Numbers
- POj 3292 Semi-prime H-numbers
- POJ 1504 Adding Reversed Numbers…
-  
-
- poj 2488
- POJ 2485 Highways
- POJ 3299
- poj 1905
- poj 数论 Semi-prime H-numbers
- ZOJ 1078 Palindrom Numbers
- POJ 1753 Flip Game
- POJ 1182 食物链
- POJ 3185 The Water Bowls
- POj 2379 ACM Rank Table
- POJ 1018 Communication System
- POJ 1050 To the Max
- 大整数运算(加法)
- 大整数运算(乘法)
- DOS命令大全
- 数列(sequence)
- POJ 1002 487-3279
- POJ 2247 Humble Numbers
- POJ 1753 Flip Game
- POj 3292 Semi-prime H-numbers
- POJ 1182 食物链
- ZZULI 1208 二叉树(1)
- ZZULI 1209 二叉树(2)
- python 加载c/c++动态库流程小记
- ZZULI 1210 二叉树(3)
- POj 2255