You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
608 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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;
}