Skip to content
GG
Ghost Graph
Ghost Graph: Interlinked notes, diagnostics, and proven scripts rendered as a navigable 3D graph.
Reading

UVa Online Judge Challenge "10550"

Return to map
Categories Java

Problem

My Solution

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {

			String temp[] = sc.nextLine().split(" ");
			if (Integer.parseInt(temp[0]) == 0 && Integer.parseInt(temp[1]) == 0 && Integer.parseInt(temp[2]) == 0
					&& Integer.parseInt(temp[3]) == 0) {

				break;
			} else {
				System.out.println(1080 + ((Integer.parseInt(temp[0]) - Integer.parseInt(temp[1]) + 40) % 40
						+ (Integer.parseInt(temp[2]) - Integer.parseInt(temp[1]) + 40) % 40
						+ (Integer.parseInt(temp[2]) - Integer.parseInt(temp[3]) + 40) % 40) * 9);
			}
		}

	}
}