fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.Scanner;
  5.  
  6. class Main
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. Scanner in = new Scanner(System.in);
  11. int a = in.nextInt();
  12. int b = in.nextInt();
  13. int c = in.nextInt();
  14. int s=0; // "s" used as an auxiliary variable to store the amount of money
  15. if (a>=b&&a>=c) {
  16. s=a;
  17. if (b>=c) {
  18. s+=c;
  19. }
  20. else s+=b;
  21. }
  22. else if (b>=a&&b>=c) {
  23. s=b;
  24. if (a>=c) {
  25. s+=c;
  26. }
  27. else s+=a;
  28. }
  29. else if (c>=a&&c>=b) {
  30. s=c;
  31. if (a>=b) {
  32. s+=b;
  33. }
  34. else s+=a;
  35. }
  36. System.out.print(s);
  37. }
  38. }
Success #stdin #stdout 0.06s 2184192KB
stdin
8 11 6
stdout
17