## Beautiful Number

Time Limit: 1 Seconds Memory Limit: 32768 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```

Output for Sample Input

```3 5 6 9```

Source: Zhejiang University Local Contest 2007, Preliminary

CODE

```#include<stdio.h> #include<string.h>   int main() { int D[100005]; int i, j, k, cnt; cnt = 1; i = 1; while(cnt <= 100000) { ++i; if(i % 3 ==0 || i % 5 == 0) D[cnt++] = i; } while(scanf("%d", &k) != EOF) printf("%d\n",D[k]); return 0; }```
» 本博客采用署名 2.5 中国大陆许可协议进行许可，本文版权归作者所有，欢迎转载，但必须在明显位置给出原文连接。
anyShare分享到：