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

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.