fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner s = new Scanner(System.in);
  13. int aE = 0;
  14. int aG = 0;
  15. int fE1 = s.nextInt();
  16. int lE1 = s.nextInt();
  17. int fE2 = s.nextInt();
  18. int lE2 = s.nextInt();
  19. int fG1 = s.nextInt();
  20. int lG1 = s.nextInt();
  21. int fG2 = s.nextInt();
  22. int lG2 = s.nextInt();
  23. for(int i = fE1; i <= lE1; i++){
  24. aE += i;
  25. }
  26. for(int i = fE2; i <= lE2; i++){
  27. aE += i;
  28. }
  29. for(int i = fG1; i <= lG1; i++){
  30. aG += i;
  31. }
  32. for(int i = fG2; i <= lG2; i++){
  33. aG += i;
  34. }
  35. aE /= lE1 - fE1 + lE2 - fE2;
  36. aG /= lG1 - fG1 + lG2 - fG2;
  37. System.out.println(aE);
  38. System.out.println(aG);
  39. if(aE==aG){
  40. System.out.println("Tie");
  41. }else if(aE > aG){
  42. System.out.println("Gunnar");
  43. }else{
  44. System.out.println("Emma");
  45.  
  46. }
  47. }
  48. }
Success #stdin #stdout 0.12s 29476KB
stdin
1 8 1 8
1 10 2 5
stdout
5
5
Tie