結果

問題 No.740 幻の木
ユーザー tentententen
提出日時 2020-12-07 10:11:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 3,968 ms
コンパイル使用メモリ 73,960 KB
実行使用メモリ 57,712 KB
最終ジャッジ日時 2023-10-17 16:00:00
合計ジャッジ時間 6,285 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,552 KB
testcase_01 AC 134 ms
57,536 KB
testcase_02 AC 131 ms
57,528 KB
testcase_03 AC 134 ms
57,528 KB
testcase_04 AC 134 ms
57,568 KB
testcase_05 AC 133 ms
57,400 KB
testcase_06 AC 133 ms
57,520 KB
testcase_07 AC 132 ms
57,712 KB
testcase_08 AC 132 ms
57,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int p = sc.nextInt();
        int q = sc.nextInt();
        int all = (12 + q) * m;
        int year = n / all;
        n %= all;
        for (int i = 1; i <= 12; i++) {
            n -= m;
            if (i >= p && i <= p + q - 1) {
                n -= m;
            }
            if (n <= 0) {
                System.out.println(year * 12 + i);
                return;
            }
        }
    }
}
0