fork download
  1. /*
  2. -> Don't stop when you're tired, stop when you're done.
  3. -> From the river to the sea, Palestine will be free.
  4. --> @author: MIDORIYA_
  5. */
  6. //*==============================================================
  7. #include <bits/stdc++.h>
  8. using namespace std;
  9. int main()
  10. {
  11. int K, S;
  12. cin >> K >> S;
  13. int ans = 0;
  14. for (int x = 0; x <= K; ++x)
  15. {
  16. for (int y = 0; y <= K; ++y)
  17. {
  18. int z = S - x - y;
  19. if (0 <= z and z <= K)
  20. {
  21. ans = ans + 1;
  22. }
  23. }
  24. }
  25. cout << ans << endl;
  26.  
  27. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
0