fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int h1, h2, h3, w1, w2, w3, count = 0;
  7. cin >> h1 >> h2 >> h3 >> w1 >> w2 >> w3;
  8.  
  9. for (int a = 1; a <= 30; a++)
  10. {
  11. for (int b = 1; b <= 30; b++)
  12. {
  13. for (int d = 1; d <= 30; d++)
  14. {
  15. for (int e = 1; e <= 30; e++)
  16. {
  17. int c = h1 - (a + b);
  18. int f = h2 - (d + e);
  19. int g = w1 - (a + d);
  20. int h = w2 - (b + e);
  21.  
  22. if (c <= 0)
  23. continue;
  24. if (f <= 0)
  25. continue;
  26. if (g <= 0)
  27. continue;
  28. if (h <= 0)
  29. continue;
  30.  
  31. if ((w3 - (c + f) == h3 - (g + h)) && (w3 - (c + f)) > 0)
  32. count++;
  33. }
  34. }
  35. }
  36. }
  37.  
  38. cout << count;
  39. }
Success #stdin #stdout 0s 548KB
stdin
Standard input is empty
stdout
Standard output is empty