A题不分早晚!
第一道枚举水题
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int p,e,i,d;
int m =1;
while((p=sc.nextInt())!=-1&&(e=sc.nextInt())!=-1&&(i=sc.nextInt())!=-1&&(d=sc.nextInt())!=-1){
sc.nextLine();
int x = d+1;
for(;x<=21252;x++){
if((x-p)%23==0)
break;
}
for(;x<=21252;x+=23){
if((x-e)%28==0)
break;
}
for(;x<=21252;x+=28*23){
if((x-i)%33==0)
break;
}
System.out.println("Case "+(m++)+": the next triple peak occurs in "+(x-d)+" days.");
}
}
}