# Marble problem I tried this problem.

## Marble

There are boxes infinitely in a straight line. Each box is labeled from left side …,-2,-1,0,1,2,… to the right side. Now R red marbles are in the -100th box. In the same way, G green mables are in the 0th box and B blue mables are in the 100th box. There no other marbles in all boxes. All boxes should have one marble at most. Repeat below process and make the number of marbles of each each at most one.

• Select one marble, move it left box or right box.
• However one box must not have more than two marbles that has different colors each other

Calculate minimum required steps.

I wrote below code.

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
* Created by sasakiumi on 3/18/14.
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

int r = sc.nextInt();
int g = sc.nextInt();
int b = sc.nextInt();

int max = Math.max(Math.max(r, g), b);

List<Integer> steps = new ArrayList<Integer>();
for (int i = 1; i <= max; i++) {
Integer pre = steps.get(i - 1);