原题
http://poj.org/problem?id=1006
源码
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int time = 0;
while (in.hasNext()) {
int p = in.nextInt(), e = in.nextInt(), i = in.nextInt(), d = in.nextInt();
if (p == -1 && e == -1 && i == -1 && d == -1)
break;
int lcm = 21252; // lcm(23,28,33)
int n = (5544 * p + 14421 * e + 1288 * i - d + lcm) % lcm;
if (n == 0)
n = 21252;
time++;
System.out.println("Case " + time + ": the next triple peak occurs in " + n + " days.");
}
}
}