Problem Solving/BOJ
[Silver 5] 1476번 날짜 계산
kmkunk
2022. 4. 1. 14:23
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] arr = br.readLine().split(" ");
int[] esm = new int[4];
int e = 1; int s = 1; int m = 1;
for(int i=1; i<=3; i++) { esm[i] = Integer.parseInt(arr[i-1]); }
for(int i=1; i<=7980; i++) {
if(e==esm[1] && s==esm[2] && m==esm[3]) {
System.out.println(i);
return;
}
e++; s++; m++;
e = (e-1)%15+1;
s = (s-1)%28+1;
m = (m-1)%19+1;
}
}
}