CodeForces 630 J. Divisibility(数论)

Description
给出一整数n,问1~n中能够整除2~10的数的个数
Input
一整数n(1<=n<=10^18)
Output
1~n中能整除2~10的数的个数
Sample Input
3000
Sample Output
1
Solution
简单数学题,2~10的最小公倍数为2520,所以1~n中能整除2~10的数有n/2520个
Code

#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
ll n;
int main()
{
    while(~scanf("%I64d",&n))
        printf("%I64d\n",n/2520);
    return 0;
}

你可能感兴趣的:(CodeForces 630 J. Divisibility(数论))