結果

問題 No.740 幻の木
ユーザー Pump0129Pump0129
提出日時 2018-11-27 23:28:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 924 bytes
コンパイル時間 5,261 ms
コンパイル使用メモリ 71,744 KB
実行使用メモリ 56,428 KB
最終ジャッジ日時 2023-09-06 23:34:36
合計ジャッジ時間 4,095 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
55,524 KB
testcase_01 AC 113 ms
55,912 KB
testcase_02 AC 116 ms
56,196 KB
testcase_03 AC 112 ms
55,816 KB
testcase_04 AC 113 ms
55,844 KB
testcase_05 AC 117 ms
55,852 KB
testcase_06 AC 122 ms
56,428 KB
testcase_07 AC 114 ms
55,796 KB
testcase_08 AC 116 ms
56,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package net.ipipip0129.yukicoder.no740;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int leaf_num = Integer.parseInt(scan.next());
        int leaf_drop_num = Integer.parseInt(scan.next());
        int begin_wind = Integer.parseInt(scan.next());
        int con_wind = Integer.parseInt(scan.next());

        int month_cnt = 0;
        int month = 1;
        int str_wind = 0;

        while (0 < leaf_num) {
            if (begin_wind == month) str_wind = con_wind;

            if (0 < str_wind) leaf_num -= leaf_drop_num * 2;
            else leaf_num -= leaf_drop_num;

            month_cnt += 1;
            month += 1;
            if (0 < str_wind) str_wind -= 1;
            if (month == 13) month = 1;
        }

        scan.close();
        System.out.println(month_cnt);
    }
}
0