Codeforces 630j Divisibility Solution
HInts:
firstly
from 1 to 2520 are divisible by all numbers from 2 to 10.found 1 times bonus.
secoundly
from 1 to 5040 are divisible by all numbers from 2 to 10.found (1+1)=2 times bonus.
thirdly
from 1 to 7560 are divisible by all numbers from 2 to 10.found (1+2)= 3times bonus.
.
.
.
.
.
how many times sum of 2520 is the bonus time.
according the above information
we found n/2520 many times he will get the bonus.
You just follow the hints and you solve this problem.I thik you slove this problem according above hints.
But unfortunately you are not understand .Then you are look my solution
Solve in C++:
firstly
from 1 to 2520 are divisible by all numbers from 2 to 10.found 1 times bonus.
secoundly
from 1 to 5040 are divisible by all numbers from 2 to 10.found (1+1)=2 times bonus.
thirdly
from 1 to 7560 are divisible by all numbers from 2 to 10.found (1+2)= 3times bonus.
.
.
.
.
.
how many times sum of 2520 is the bonus time.
according the above information
we found n/2520 many times he will get the bonus.
You just follow the hints and you solve this problem.I thik you slove this problem according above hints.
But unfortunately you are not understand .Then you are look my solution
Solve in C++:
- ///**********ALLAH IS ALMIGHTY************///
- ///AH Tonmoy
- ///Department of CSE
- ///Islamic University,Bangladesh
- #include<iostream>
- using namespace std;
- int main()
- {
- long long n;
- cin>>n;
- cout<<n/2520<<endl;
- }
No comments