当前位置:网站首页>OJ 1131 beautiful number
OJ 1131 beautiful number
2022-07-28 06:38:00 【JETECHO】
describe
Xiao Ming likes 3 and 5 These two numbers , He will be able to be 3 or 5 The number of integral division is called beautiful number . Now I'll give you an integer N(1<=N<=100000), Can you tell xiaomingdi N What is the number of beauties ?
Input
Input contains multiple sets of test data . Enter an integer for each group N(1<=N<=100000).
Output
For each group of input , Output No N A beautiful number .
sample input 1
1
2
3
4
sample output 1
3
5
6
9
The title requires finding out the number of beautiful numbers , Then we can first The meter , Then output directly
#include <iostream>
using namespace std;
long long a[100001];
int j=1;
void creat()
{
a[j++]=3;long long i=4;
while(j<=100000)
{
if(i%3==0||i%5==0)
a[j++]=i;
i++;
}
}
int main()
{
creat();
int n;
while(cin>>n)
cout<<a[n]<<endl;
return 0;
}
边栏推荐
- 做气传导耳机最好的是哪家、最好的气传导耳机盘点
- New Selenium
- Perl introductory learning (XI) file operation
- 2022-06-07 VI. log implementation
- 【动态规划--买卖股票的最佳时期系列3】
- QT solves the problem of rebuilding UI files every time they are modified
- Filter
- 战疫杯--我的账本
- Find the network address and broadcast address of the host according to the IP address and subnet mask
- 空气传导耳机哪个牌子好、备受好评的气传导耳机推荐
猜你喜欢
随机推荐
Leetcode 刷题日记 剑指 Offer II 055. 二叉搜索树迭代器
藏宝计划TPC系统开发Dapp搭建
QT batch operation control and set signal slot
New Selenium
Icc2 (III) clock tree synthesis
2022-07-19 Damon database - instance creation and management
Hugging face's problem record I
微信小程序自定义编译模式
Development of Quantitative Trading Robot System
浮点型数据在内存中如何存储
七夕礼物送女生什么好?颜值在线又有心意的礼物推荐
气传导耳机哪个好、性价比最高的气传导耳机推荐
Execjs call
2022-07-19 Damon database connection instance, execution script, system command
如何模拟实现strcpy库函数
My notes
关于Shader KeyWord的整理
Find the network address and broadcast address of the host according to the IP address and subnet mask
【C语言】自定义结构体类型
战疫杯--奇奇怪怪的形状



![[c语言]--一步一步实现扫雷小游戏](/img/ee/49ddfcd948ccd5c8c9dec3c48c6112.png)




