CSES - Putka Open 2015 – 1/6 - Results
Submission details
Task:Jakkara
Sender:
Submission time:2015-07-18 03:26:02 +0300
Language:Java
Status:COMPILE ERROR

Compiler report

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

Code

import java.util.*;

public class Jakkara {
	@SuppressWarnings("resource")
	public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int[] in = {
		    input.nextInt(),
		    input.nextInt(),
		    input.nextInt(),
		    input.nextInt()
        };
        
        int paras = 999999999;
        
        for (int i = 0; i < 4; i++) {
        	int yht = 0;
        	
        	for (int x = 0; x < 4; x++) {
            	if (in[i] < in[x]) {
            		yht = yht + (in[x] - in[i]);
            	}
            	
            	if (in[i] > in[x]) {
            		yht = yht + (in[x] + in[i]);
            	}
            }
        	
        	if (yht < paras) {
        		paras = yht;
        	}
        }
        
        System.out.println(paras);
	}
}