[BOJ] 1476. 날짜 계산
15 Apr 2026
Reading time ~1 minute
풀이
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int E=sc.nextInt();
int S=sc.nextInt();
int M=sc.nextInt();
int cnt=0;
int Ec=0,Sc=0,Mc=0;
while(true) {
if(Ec==E && Sc==S && Mc==M) {
break;
}
if(Ec>=15) {
Ec=0;
}
if(Sc>=28) {
Sc=0;
}
if(Mc>=19) {
Mc=0;
}
Ec++;Sc++;Mc++;
cnt++;
}
System.out.println(cnt);
}
}