Advertisement
Egonau

quad

Oct 3rd, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     ios_base::sync_with_stdio(false);
  7.     cin.tie(NULL);
  8.     cout.tie(NULL);
  9.     long int spos = 0;
  10.     long long int w, h, s;
  11.     cin >> h >> w >> s;
  12.     if (s > h * w) cout << 0;
  13.     else if (s == h * w) cout << 1;
  14.     else
  15.     {
  16.         for (long long int i = 1; i <= s; ++i) {
  17.             long long int dr = s / i;
  18.             if (s % i == 0) {
  19.                  long int vd = h + 1 - dr;
  20.                  long int vsh = w + 1 - i;
  21.                 if (vd * vsh >= 0) spos += vd * vsh;
  22.  
  23.  
  24.             }
  25.         }
  26.         cout << spos;
  27.  
  28.  
  29.  
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement