题目链接
【题意】
求1~n中能整除2~10的数的数量,其中n<=
10^18
【分析】
能整除
2~
10的数一定是他们的公倍数,然后易得他们的最小公倍数为
2^
3*3^
2*5*7=
2520
故能整除
2~
10的数与能整除
2520等价
然后只要看看这些数中有多少是
2520的倍数就好啦
注意用long long
【Code】
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
long long n;
cin>>n;
cout<<n/
2520;
return 0;
}
转载请注明原文地址: https://www.6miu.com/read-48845.html