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++:
  1. ///**********ALLAH IS ALMIGHTY************///
  2. ///AH Tonmoy
  3. ///Department of CSE
  4. ///Islamic University,Bangladesh
  5. #include<iostream>
  6. using namespace std;
  7. int main()
  8. {
  9. long long n;
  10. cin>>n;
  11. cout<<n/2520<<endl;
  12. }

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.