fork download
  1. package graphT;
  2. import java.io.*;
  3. import java.lang.Math.*;
  4. import java.util.Scanner;
  5. class codeforces {
  6. public static void main(String args[]) {
  7. int y,b,ans=0;
  8.  
  9. Scanner s = new Scanner(System.in);
  10. y=s.nextInt();
  11. b=s.nextInt();
  12. int a1=s.nextInt();
  13. int a2=s.nextInt();
  14. int a3=s.nextInt();
  15. if(y-(a1*2)>0)
  16. {
  17. y=y-(a1*2);
  18. if(y-a2<0)
  19. ans=ans+(a2-y);
  20. }
  21. else
  22. ans=(a1*2)-y+a2;
  23. if(b-(a3*2)>0)
  24. {
  25. b=b-(a3*2);
  26. if(b-a2<0)
  27. ans=ans+(a2-b);
  28. }
  29. else
  30. ans=ans+((a3*2)-b)+a2;
  31. //if((y-(a1*2)>0) && (b-(a3*2)>0) && )
  32.  
  33.  
  34. System.out.println(ans);
  35. }
  36. }
  37.  
Runtime error #stdin #stdout #stderr 0.06s 4706304KB
stdin
4 3
2 2 1
stdout
Standard output is empty
stderr
Error: Could not find or load main class codeforces