CSES - Putka Open 2015 – 1/6 - Results
Submission details
Task:Jakkara
Sender:
Submission time:2015-07-19 15:52:01 +0300
Language:Java
Status:COMPILE ERROR

Compiler report

input/jalka.java:3: error: class Hiekkalaatikko is public, should be declared in a file named Hiekkalaatikko.java
public class Hiekkalaatikko {
       ^
1 error

Code

import java.util.Scanner;
public class Hiekkalaatikko {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int a, b, c, d = 0;
a = input.nextInt();
b = input.nextInt();
c = input.nextInt();
d = input.nextInt();
int keski = (a + b + c + d) / 4;
int energia = 0;
energia += energiaa(a, keski);
energia += energiaa(b, keski);
energia += energiaa(c, keski);
energia += energiaa(d, keski);
System.out.println(energia);
}
public static int energiaa(int jalka, int keski) {
if (jalka > keski) {
return jalka - keski;
} else {
return jalka + keski;
}
}
}