这道题有很多种做法,但是思路大都是一样的,代码有点类似于poj2591这道题。

题意:问因子只含有2,3,5,7的第k个数是什么?

#include<stdio.h>
int f[5843],n;
int i,j,k,l;
int Min(int a,int b,int c,int d)
{
int _min = a;
if(b<_min) _min = b;
if(c<_min) _min = c;
if(d<_min) _min = d; if(a==_min) i++;
if(b==_min) j++;
if(c==_min) k++;
if(d==_min) l++; return _min;
}
int main()
{
i=j=k=l=1;
f[1] = 1;
for(int t=2;t<=5842;t++)
f[t] = Min(2*f[i],3*f[j],5*f[k],7*f[l]);
while(scanf("%d",&n),n)
{
if(n%100==11||n%100==12||n%100==13)
printf("The %dth humble number is %d.\n",n,f[n]);
else if(n%10==1)
printf("The %dst humble number is %d.\n",n,f[n]);
else if(n%10==2)
printf("The %dnd humble number is %d.\n",n,f[n]);
else if(n%10==3)
printf("The %drd humble number is %d.\n",n,f[n]);
else
printf("The %dth humble number is %d.\n",n,f[n]);
}
return 0;
}

最新文章

  1. android srudio使用HttpClient
  2. 打印发现function toUpperCase() { [native code] }
  3. java 移位运算符
  4. c51跑马灯
  5. MooseFs-分布式文件系统系列(二)之安装总结
  6. mac os 添加用户到组 命令
  7. 启动PL/SQL Developer 报字符编码不一致错误 Database character set (AL32UTF8) and Client character set (ZHS16GBK) are different. Character set conversion may cause unexpected results. Note: you can set the client
  8. ios开发——实用技术篇&amp;XML协议详解
  9. EasyUI datagrid 改变url属性 实现动态加载数据
  10. IO流--转载
  11. 摇滚吧HTML5!有声前端交互!(Hello, Jsonic!)
  12. MySQ备份常见问题
  13. [Python] 图像简单处理(PIL or Pillow)
  14. linux 每天一点点 【ubuntu16.04 】
  15. 1084: 开心的小明(dengdengoj)
  16. mybatis-generator自动生成代码工具
  17. Luogu 1525 【NOIP2010】关押罪犯 (贪心,并查集)
  18. 3.C#的访问权限修饰符
  19. 关于LeNet-5卷积神经网络 S2层与C3层连接的参数计算的思考???
  20. Eclipse修改已存在的SVN地址

热门文章

  1. 初涉定制linux系统之——rpm相关安装包的准备
  2. IDEA artifacts Web Application:Exploded Web Application:Archive
  3. clion register
  4. [SCOI2007]修车(建图好题)
  5. Excel单元格内容批量加前缀
  6. swift中UITextView的使用
  7. docker搭建nginx
  8. 解决 listView gridView 与ScrollView嵌套时的冲突
  9. Loitor_产品(二)校准立体摄像机
  10. Java数据结构和算法(四)赫夫曼树