题目链接

题意:素因子中只有2 3 5 7的数称为谦逊的数,1也是谦逊的数,题目中已经给出了前20个谦逊的数。给定数字n,按格式输出第n个谦逊的数。

题解:打表即可,注意打表的技巧就行了。

ps:这道题和去年多校做过的一道题很像,那道题是输出大于等于n的第一个数,附上链接:传送门

#include <cstdio>
#include <iostream>
using namespace std;
#define N 6005
typedef long long ll;
ll data[N];
int cnt,n;
void get()
{
cnt=;
data[]=;
int p2=,p3=,p5=,p7=;
for(int i=; i<=; i++)
{
data[i]=min(min(data[p2]*,data[p3]*),min(data[p5]*,data[p7]*));
if(data[i]==data[p2]*) p2++;
if(data[i]==data[p3]*) p3++;
if(data[i]==data[p5]*) p5++;
if(data[i]==data[p7]*) p7++;
}
}
int main()
{
get();
while(scanf("%d",&n)&&n)
{
printf("The %d",n);
if(n%!=&&n%==) printf("st");
else if(n%!=&&n%==) printf("nd");
else if(n%!=&&n%==) printf("rd");
else printf("th");
printf(" humble number is ");
printf("%lld.\n",data[n]);
}
return ;
}

SCU 1029 Humble Numbers (打表处理)的更多相关文章

  1. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  2. HDU - The number of divisors(约数) about Humble Numbers

    Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence ...

  3. A - Humble Numbers

    Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Pract ...

  4. The number of divisors(约数) about Humble Numbers[HDU1492]

    The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Lim ...

  5. Humble Numbers

    Humble Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9988 Accepted: 4665 Descri ...

  6. 洛谷P2723 丑数 Humble Numbers

    P2723 丑数 Humble Numbers 52通过 138提交 题目提供者该用户不存在 标签USACO 难度普及/提高- 提交  讨论  题解 最新讨论 暂时没有讨论 题目背景 对于一给定的素数 ...

  7. HDU 1058 Humble Numbers (DP)

    Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)To ...

  8. HDOJ 1058 Humble Numbers(打表过)

    Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The ...

  9. The number of divisors(约数) about Humble Numbers

    The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Lim ...

随机推荐

  1. Python的压缩文件处理 zipfile & tarfile

    本文从以下两个方面, 阐述Python的压缩文件处理方式: 一. zipfile 二. tarfile 一. zipfile 虽然叫zipfile,但是除了zip之外,rar,war,jar这些压缩( ...

  2. dedecms给原模型添加新字段

    1.进入dedecms后台 2.点击核心=>频道模型=>内容模型管理(在这里可以看到dedecms预设的模型设置) 3.选中我们需要的模型,点击更改,跳入以下页面 4.点击字段管理(可以看 ...

  3. MyBatis原理简介

    1.什么是 MyBatis ? MyBatis 是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.MyB ...

  4. 【Python】Python SQLAlchemy基本操作和常用技巧

    首先说下,由于最新的 0.8 版还是开发版本,因此我使用的是 0.79 版,API 也许会有些不同.因为我是搭配 MySQL InnoDB 使用,所以使用其他数据库的也不能完全照搬本文. 接着就从安装 ...

  5. bzoj1069-最大土地面积

    题目 给定\(n\ (n\le 2000)\)个坐标,求四个坐标使得围起来的四边形面积最大. 分析 最暴力的想法是枚举四个点,然而肯定超时.接着不知道怎么想到中途相遇,然而一点关系都没有.这里用到了一 ...

  6. Java基础之开关语句详解

    switch 语句是单条件多分支的开关语句,它的一般格式定义如下(其中break语句是可选的): switch(表达式) { case 常量值: 若干个语句 break; case  常量值: 若干个 ...

  7. 【刷题】SPOJ 705 SUBST1 - New Distinct Substrings

    Given a string, we need to find the total number of its distinct substrings. Input T- number of test ...

  8. 【BZOJ1486】最小圈(分数规划)

    [BZOJ1486]最小圈(分数规划) 题面 BZOJ 洛谷 求图中边权和除以点数最小的环 题解 分数规划 二分答案之后将边权修改为边权减去二分值 检查有无负环即可 #include<iostr ...

  9. POJ2549:Sumsets——题解

    http://poj.org/problem?id=2549 题目大意:从集合中找到四个不相同的数,满足a+b+c=d,输出最大的d. —————————————————————————— 该式子变为 ...

  10. 【bzoj2743】[HEOI2012]采花 树状数组

    题目描述 萧芸斓是Z国的公主,平时的一大爱好是采花. 今天天气晴朗,阳光明媚,公主清晨便去了皇宫中新建的花园采花.花园足够大,容纳了n朵花,花有c种颜色(用整数1-c表示),且花是排成一排的,以便于公 ...