当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
随机推荐
自定义组件--样式
自定义组件--数据监听器
SSAO By Computer Shader(二)
My notes
2022-05-15 基于jwt令牌token
Get the current directory in QT
STM32的IAP跳转相关bug经历
Leetcode 刷题日记 剑指 Offer II 048. 序列化与反序列化二叉树
2022年七夕礼物推荐!好看便宜又实用的礼物推荐
【动态规划--买卖股票的最佳时期系列3】
关于Shader KeyWord的整理
Redhawk Dynamic Analysis
2022-05-24 SpEL使用
OpenGL development environment configuration [vs2017] + frequently asked questions
如何模拟实现strcpy库函数
Development of Quantitative Trading Robot System
QT implementation outputs relevant information to log file
【学习笔记】线程创建
Combine multiple ICs calendars into a single ICs calendar
OJ 1020 最小的回文数






![[哈希表基础知识]](/img/8f/54a4780a02f81e5de3d92c25248e1e.png)
![[c语言]--一步一步实现扫雷小游戏](/img/ee/49ddfcd948ccd5c8c9dec3c48c6112.png)

