题目链接:

  http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2829

题目描述:

  Mike is very lucky, as he has two beautiful numbers, 3 and 5. But he is so greedy that he wants infinite beautiful numbers. So he declares that any positive number which is dividable by 3 or 5 is beautiful number. Given you an integer N (1 <= N <= 100000), could you please tell mike the Nth beautiful number?

Input

The input consists of one or more test cases. For each test case, there is a single line containing an integer N.

Output

For each test case in the input, output the result on a line by itself.

Sample Input

1
2
3
4

Sample Output

3
5
6
9

 /*问题 查询第几个漂亮数字是多少
解题思路 一般来讲,最直观的做法是将创建一个10 0000的数组,将每个漂亮数存进数组,最后查询即可*/
#include <cstdio>
int bn[];
int main()
{
int count=,i=;
while()
{
if(i % == || i % == ){
bn[count++]=i;
if(count > )
break;
}
i++;
}
int n;
while(scanf("%d",&n) != EOF)
{
printf("%d\n",bn[n]);
}
return ;
}

zoj Beautiful Number(打表)的更多相关文章

  1. HDU 5179 beautiful number (数位dp / 暴力打表 / dfs)

    beautiful number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  2. zoj 2829 Beautiful Number

    Beautiful Number Time Limit: 2 Seconds      Memory Limit: 65536 KB Mike is very lucky, as he has two ...

  3. hdu 5179 beautiful number

    beautiful number 问题描述 令 A = \sum_{i=1}^{n}a_i * {10}^{n-i}(1\leq a_i \leq 9)A=∑​i=1​n​​a​i​​∗10​n−i​ ...

  4. Codeforces 55D Beautiful Number

    Codeforces 55D Beautiful Number a positive integer number is beautiful if and only if it is divisibl ...

  5. beautiful number 数位DP codeforces 55D

    题目链接: http://codeforces.com/problemset/problem/55/D 数位DP 题目描述: 一个数能被它每位上的数字整除(0除外),那么它就是beautiful nu ...

  6. Beautiful Number

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2829 Beautiful Number Time Limit: 2 Sec ...

  7. ZOJ 3622 Magic Number 打表找规律

    A - Magic Number Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Subm ...

  8. Codeforces 55D Beautiful Number (数位统计)

    把数位dp写成记忆化搜索的形式,方法很赞,代码量少了很多. 下面为转载内容:  a positive integer number is beautiful if and only if it is  ...

  9. codeforces 893B Beautiful Divisors 打表

    893B Beautiful Divisors 思路: 打表 代码: #include <bits/stdc++.h> using namespace std; #define _for( ...

随机推荐

  1. G - Christmas Play

    Description My kid's kindergarten class is putting up a Christmas play.  (I hope he gets the lead ro ...

  2. unigui导出EXCEL使用NATIVEEXCEL

    unigui导出EXCEL使用NATIVEEXCEL // 需要nativeexcel控件// cxg 2017-9-9 unit myExcel; interface uses System.Sys ...

  3. delphi 窗体自适应屏幕分辨率

    delphi 窗体自适应屏幕分辨率 这是个困惑我很长时间的问题,到今天终于得到解决了. 话说Delphi有个很强的窗体设计器,这一点让VC粉丝垂涎三尺而不可得.但是,Delphi里设计的窗体并没有自动 ...

  4. 在 Centos7 的KVM上启用嵌套虚拟化

    1.嵌套虚拟化意味着在虚拟机内配置虚拟化环境.换句话说,我们可以说嵌套虚拟化是虚拟机管理程序hypervisor的一个特性,它允许我们通过虚拟化管理程序(宿主机)的硬件加速在虚拟服务器内安装和运行虚拟 ...

  5. C# 简单反射实现winform左侧树形导航,右侧切换内容

    先看看效果: 核心代码: using System; using System.Collections.Generic; using System.ComponentModel; using Syst ...

  6. InfluxDB 安装以及使用

    InfluxDB InfluxDB简介: InfluxDB 是一个开源分布式时序.事件和指标数据库.使用Go语言编写,无需外部依赖.其设计目标是实现分布式和水平伸缩扩展.        它有三大特性: ...

  7. 改变PowerDesigner数据模型字体大小

    一 改变左侧菜单字体大小Tools----->General------->Fonts-------->根据item选项的不同改变字体的大小 二 改变数据模型Table的字体大小To ...

  8. AJPFX平台:中国的经济是个大泡沫吗?这个泡沫即将崩解吗?

    AJPFX问:中国的经济是个大泡沫吗?这个泡沫即将崩解吗? 这一老问题,最近又一次引起世界的关注. 首先,中国在领导层变更之际,把2013年的增长目标定为7.5%,“保八”的调子不再,两位数高增长的时 ...

  9. 反射 方法和函数 type

    1. isinstance/issubclass/type  *** issubclass 判断xxx类是否是xxx类的子类 class Animal: pass class Cat(Animal): ...

  10. C#6.0语言规范(十) 类

    类是可以包含数据成员(常量和字段),函数成员(方法,属性,事件,索引器,运算符,实例构造函数,析构函数和静态构造函数)和嵌套类型的数据结构.类类型支持继承,这是一种派生类可以扩展和专门化基类的机制. ...