結果

問題 No.740 幻の木
ユーザー YamaKasaYamaKasa
提出日時 2018-10-05 21:42:49
言語 Java
(openjdk 23)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 74,740 KB
実行使用メモリ 54,256 KB
最終ジャッジ日時 2024-10-12 12:59:25
合計ジャッジ時間 4,246 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();
		int P = scan.nextInt();
		int Q = scan.nextInt();
		scan.close();
		int t = 0;
		int cnt = 0;
		while(N > 0) {
			if(t >= P - 1 && t < P + Q - 1) {
				N -= 2 * M;
			}else {
				N -= M;
			}
			t ++;
			t = t % 12;
			cnt ++;
		}
		System.out.println(cnt);
	}
}
0