Beautiful Number


Time Limit: 2 Seconds      Memory Limit: 65536 KB

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

 #include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
vector<int> v;
int main(){
int n = , i = , num;
while(){
if(n > )
break;
if(i % == || i % == ){
v.push_back(i);
n++;
}
i++;
}
while(cin >> num){
printf("%d\n", v[num - ]);
}
return ;
}

zoj 2829 Beautiful Number的更多相关文章

  1. poj 3100 (zoj 2818)||ZOJ 2829 ||ZOJ 1938 (poj 2249)

    水题三题: 1.给你B和N,求个整数A使得A^n最接近B 2. 输出第N个能被3或者5整除的数 3.给你整数n和k,让你求组合数c(n,k) 1.poj 3100 (zoj 2818) Root of ...

  2. Beautiful Number

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

  3. zoj Beautiful Number(打表)

    题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2829 题目描述: Mike is very lucky, as ...

  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. 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​ ...

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

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

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

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

  9. ZOJ 3622 Magic Number 打表找规律

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

随机推荐

  1. php 缩略图

    <!DOCTYPE html><!-- HTML5表单 --><form method="post" action="" enct ...

  2. 三色灯渐变DIY制作

    小编前几天查资料,怎么使用12864屏幕的用法,突然发觉微博是个好东西,随着自己的成长,学习了很多的知识,没有做笔记的习惯,只是习惯把用到的硬件,传感器,资料写到程序的备注内,但感觉,用到时不是那么方 ...

  3. Oracle历史版本及oracle相关软件下载地址

    网站:https://edelivery.oracle.com/ 可能需要注册个账号!!!(账号注册登录自己折腾下就好了) 下载数据库或者oracle的相关软件的话,如下 选择对应的下载即可!

  4. java之idea打jar包

    1.选中项目右键,选择Open module settings,如图: 2.点击Artifacts,添加jar,如图: 3.create jar,必须选择项目的更目录 4.build artfacts ...

  5. RabbitMq+Haproxy负载均衡

    HAProxy是一个使用C语言编写的自由及开放源代码软件,其提供高可用性.负载均衡,以及基于TCP和HTTP的应用程序代理. HAProxy特别适用于那些负载特大的web站点,这些站点通常又需要会话保 ...

  6. CF982C Cut 'em all!

    思路: 在深搜过程中,贪心地把树划分成若干个连通分支就可以了.划分的条件是某个子树有偶数个节点.注意到在一次划分之后并不需要重新计数,因为一个数加上一个偶数并不影响这个数的奇偶性. 实现: #incl ...

  7. poj3616 Milking Time

    思路: dp. 实现: #include <iostream> #include <cstdio> #include <algorithm> using names ...

  8. Python学习日记之Python函数及方法使用总结

    1.  DocStrings 文档字符串     可以直接输出位于函数内定义的说明 # -*- coding:utf-8 -*- def printMax(x, y): '''示例: 说明文档''' ...

  9. 类似QQ在线离线好友界面

    把头像设置成圆形的代码如下: package com.example.lesson6_11_id19; import android.content.Context; import android.c ...

  10. 架包Error inflating class错误

    当引用架包后,出现Error inflating class错误时通常要检测架包是否正确引用: 1.首先将你所需要的架包拷贝到工程目录下: 2.右击工程,选择Build Path-->confi ...