When the natural number n sequentially capturing 1,2,3, ......, N, the equation ⌊n / 2⌋ + ⌊n / 3⌋ + ⌊n / 5⌋ how many different values are? (Note: ⌊x⌋ to rounding function, x represents no more than the maximum natural number, i.e. the integer part of x.)
Input formats:
Input gives a positive integer N (2≤N≤10 4).
Output formats:
The number of different values of the output face formula title in a row to take.
Sample input:
2017
Sample output:
1480
#include<iostream>
using namespace std;
int main(){
// freopen("input.txt","r",stdin);
int n,ans=0,now=-1;
cin>>n;
for(int i=1;i<=n;i++){
int x = i/2+i/3+i/5;
if(x!=now){
ans++; now=x;
}
}
cout<<ans;
return 0;
}