본문 바로가기
알고리즘 & 자료구조/백준

백준 1476

by 신재권 2021. 9. 25.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main1476 {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int E = Integer.parseInt(st.nextToken());
		int S = Integer.parseInt(st.nextToken());
		int M = Integer.parseInt(st.nextToken());
		
		int e=1, s=1, m=1;
		
		for(int i=1; ; i++){
			if(e == E && s == S && m == M){
				System.out.println(i);
				break;
			}
			e +=1;
			s +=1;
			m +=1;
			if(e == 16){
				e = 1;
			}
			if(s == 29){
				s = 1;
			}
			if(m == 20){
				m = 1;
			}
		}
		
	}

}

'알고리즘 & 자료구조 > 백준' 카테고리의 다른 글

백준 5585  (0) 2021.11.01
백준 1107  (0) 2021.09.30
백준 3085  (0) 2021.09.23
백준 1271  (0) 2021.09.21
백준 2309  (0) 2021.09.16