daily pastebin goal
25%
SHARE
TWEET

table

a guest Oct 21st, 2018 117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     unsigned long a, b, k;
  7.     cin >> a >> b >> k;
  8.     if (a<k || b<k)
  9.         cout << 0;
  10.     else if (a>=b && b/k==1)
  11.         cout << a/k;
  12.     else if (a<=b && a/k==1)
  13.         cout << b/k;
  14.     else if (a>b && b/k>=2)
  15.         cout << 2*(a/k) + 2*((b/k)-2);
  16.     else
  17.         cout << 2*(b/k) + 2*((a/k)-2);
  18.  
  19.     return 0;
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top