Codeforces 682A. Alyona and Numbers Solution

 Click :Hints

 Solution in C++:

///**********ALLAH IS ALMIGHTY************///

///AH Tonmoy

///Department of CSE,23rd batch

///Islamic University,Bangladesh  

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. ll findCountOfPairs(ll a, ll b,ll n)
  5. {
  6. ll ans = 0;
  7. for (ll i = 1; i <= a; i++) {
  8. ans += b / n;
  9. ans += (i % n + b % n) >= n ? 1 : 0;
  10.  
  11. }
  12. return ans;
  13. }
  14. int main()
  15. {
  16. ll a , b , n = 5;
  17. cin>>a>>b;
  18. cout << findCountOfPairs(a, b, n)<<endl;
  19. return 0;
  20. }

No comments

Most View Post

Recent post

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.