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. 求n的因子个数与其因子数之和

    方法一:朴素算法:O(n). #include<bits/stdc++.h> using namespace std; int get_num(int n){ ; ;i<=n;++i ...

  2. debug授权码

    www.vfxcx.com 704835b5c54b56426257e0742568fe54

  3. Super Mario 树状数组离线 || 线段树

    Super Mario Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  4. JSP九大内置对象的作用和用法总结【转】

    JSP九大内置对象的作用和用法总结?     JSP中一共预先定义了9个这样的对象,分别为:request.response.session.application.out.pagecontext.c ...

  5. qconshanghai2017

    https://2017.qconshanghai.com/schedule 第一天 (2017/10/17 星期二) 时间 日程 07:45-09:00 签到 上午 主题演讲 软件质量优化与平台创新 ...

  6. 外文翻译 《How we decide》多巴胺的预言 第一节

    这是第二章的起始... 书的导言 1991年2月24日凌晨.第一与第二海军陆战队大批向北进入了沙特阿拉伯的沙漠地带,他们从这来进入科威特.这批军队是伊拉克入侵8个月以来,同盟国第一批进入科威特的部队. ...

  7. AJPFX关于对集合中的元素删除操作和注意点

    import java.util.ArrayList;import java.util.Iterator;import java.util.List; public class ForeTest2 { ...

  8. ios MD5大小写加密

    #import "NSString+change.h" #import <CommonCrypto/CommonDigest.h> @implementation NS ...

  9. java中properties的使用实例

    package com.ywx.io; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputSt ...

  10. MongoDB最简单的入门教程之四:使用Spring Boot操作MongoDB

    Spring Boot 是一个轻量级框架,可以完成基于 Spring 的应用程序的大部分配置工作.Spring Boot的目的是提供一组工具,以便快速构建容易配置的Spring应用程序,省去大量传统S ...