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

백준 1333

by 신재권 2021. 11. 16.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main1333 {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int N = Integer.parseInt(st.nextToken()); //노래 곡수
		int L = Integer.parseInt(st.nextToken()); //노래 초 
		int D = Integer.parseInt(st.nextToken()); //전화벨 D초에 1번씩 울림, 1초동안 울림

		int[] time = new int[5000];
		int sec = 0 ;
		for(int i=0; i<N; i++){
			
			for(int j=0; j<L; j++){
				time[sec++] = 1;
			}	
			sec += 5;
		}
		sec = 0;
		while(true){
			
			if(time[sec] == 0){
				System.out.println(sec);
				break;
			}
			sec += D;
		}
		
	}

}

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

백준2154  (0) 2021.11.18
백준 1703  (0) 2021.11.17
백준 1308  (0) 2021.11.15
백준 1296  (0) 2021.11.14
백준 1268  (0) 2021.11.13