結果

問題 No.740 幻の木
ユーザー tsunabittsunabit
提出日時 2019-07-03 22:53:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 3,905 ms
コンパイル使用メモリ 78,912 KB
実行使用メモリ 57,444 KB
最終ジャッジ日時 2023-10-17 07:16:46
合計ジャッジ時間 5,744 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
57,424 KB
testcase_01 AC 133 ms
57,420 KB
testcase_02 AC 136 ms
57,400 KB
testcase_03 AC 136 ms
57,404 KB
testcase_04 AC 134 ms
57,444 KB
testcase_05 AC 133 ms
57,284 KB
testcase_06 AC 138 ms
57,388 KB
testcase_07 AC 132 ms
57,296 KB
testcase_08 AC 132 ms
57,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No740 {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt(), m = sc.nextInt(), p = sc.nextInt(), q = sc.nextInt();
    	int mo = 1, c = 0;
    	while(n > 0) {
    		c++;
    		n = n - m;
    		if(p <= mo && mo <= p + q - 1) {
    			n = n - m;
    		}
    		mo = mo < 12? mo + 1 : 1;
    	}
    	System.out.println(c);
    }
}
0