fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. /*
  5.  
  6.  
  7.   */
  8. int k,s,x, y,z, ans;
  9. scanf("%d%d", &k, &s);
  10.  
  11. for(x=0, ans= 0; x<=k; x++)
  12. {
  13. for(y=0; y <=k; y++)
  14. {
  15. z = s - (x + y);
  16. if ((x+ y + z == s) && ( z <= k ) && (z >=0))
  17. {
  18. ans++;
  19. }
  20.  
  21. }
  22. }
  23. printf("%d\n", ans);
  24.  
  25.  
  26.  
  27. return 0;
  28. }
  29.  
  30.  
Success #stdin #stdout 0s 5508KB
stdin
Standard input is empty
stdout
0