백준 #31712번 핑크빈 레이드

jhj·2024년 5월 19일

백준 JAVA

목록 보기
471/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int cu = sc.nextInt();
		int du = sc.nextInt();
		int cd = sc.nextInt();
		int dd = sc.nextInt();
		int cp = sc.nextInt();
		int dp = sc.nextInt();
		int h = sc.nextInt();
		
		int count = 0;
		h = h - du - dd - dp;
		
		while(h > 0) {
			count++;
			if(count % cu == 0) {
				h -= du;
			}
			if(count % cd == 0) {
				h -= dd;
			}
			if(count % cp == 0) {
				h -= dp;
			}
		}
		System.out.println(count);
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글