UVa Online Judge Challenge "10550"

Published: November 9, 2017 | Last Modified: May 2, 2025

Tags: uva coding challenge

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);
			}
		}

	}
}