Guest User

Untitled

a guest
Mar 30th, 2020
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. #define ll long
  3. const int maxN = 5001;
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. ll m, n, p;
  9. cin >> n >> m >> p;
  10.  
  11. ll temp = (n + 1) * n * (m + 1) * m / 4;
  12.  
  13. if(p % 2 == 1)
  14. p++;
  15. else
  16. p = p / 2;
  17.  
  18. for(ll i = 2; i < p; ++i)
  19. {
  20. for(ll j = 1; j <= i - 1; ++j)
  21. {
  22. ll x = j;
  23. ll y = i - j;
  24. if(n - x + 1 >0 && m - y + 1 > 0)
  25. {
  26. temp -= (n - x + 1) * (m - y + 1);
  27. }
  28. }
  29. }
  30. cout << temp;
  31. }
RAW Paste Data