Skip to content

Instantly share code, notes, and snippets.

@Trimad
Last active April 8, 2022 03:23
Show Gist options
  • Save Trimad/db3197d5a0cfc2610020dc54cce4cb29 to your computer and use it in GitHub Desktop.
Save Trimad/db3197d5a0cfc2610020dc54cce4cb29 to your computer and use it in GitHub Desktop.
UVa 10550
/* * * * * * * * *
* Tristan Madden
* 11/09/2017
* UVa 10550
* * * * * * * * */
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);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment