29 lines
636 B
C++
29 lines
636 B
C++
#include<bits/stdc++.h>
|
||
using namespace std;
|
||
|
||
#define Maxn 59084709587505
|
||
int a[3] = {3,5,7};
|
||
int main() {
|
||
//选择set容器,set作为一个容器是用来存储同一数据类型的数据类型,并且能从一个数据集合中取出数据,
|
||
//在set中每个元素的值都唯一,而且系统能根据元素的值自动进行排序。
|
||
set<long long int> se;
|
||
|
||
long long int lucky_num = 1;
|
||
while(1) {
|
||
|
||
if(lucky_num == Maxn)
|
||
break;
|
||
|
||
for(int i = 0; i < 3; i++) {
|
||
long long int temp = lucky_num*a[i];
|
||
if(temp <= Maxn) {
|
||
cout<<temp<<endl;
|
||
se.insert(temp);
|
||
}
|
||
}
|
||
lucky_num = *se.upper_bound(lucky_num);
|
||
}
|
||
cout<<se.size()<<endl;
|
||
return 0;
|
||
}
|