結果
問題 | No.740 幻の木 |
ユーザー | htensai |
提出日時 | 2020-05-13 11:41:12 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 122 ms / 2,000 ms |
コード長 | 618 bytes |
コンパイル時間 | 1,944 ms |
コンパイル使用メモリ | 71,892 KB |
実行使用メモリ | 56,216 KB |
最終ジャッジ日時 | 2023-10-12 16:54:07 |
合計ジャッジ時間 | 3,775 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
56,020 KB |
testcase_01 | AC | 120 ms
56,020 KB |
testcase_02 | AC | 122 ms
56,208 KB |
testcase_03 | AC | 120 ms
56,216 KB |
testcase_04 | AC | 120 ms
56,092 KB |
testcase_05 | AC | 120 ms
56,184 KB |
testcase_06 | AC | 120 ms
55,812 KB |
testcase_07 | AC | 121 ms
56,184 KB |
testcase_08 | AC | 120 ms
55,900 KB |
ソースコード
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[] arr = new int[13]; int total = 0; for (int i = 1; i <= 12; i++) { if (i >= p && i < p + q) { arr[i] = m * 2; } else { arr[i] = m; } total += arr[i]; } int year = n / total; n -= total * year; int month = year * 12; int idx = 1; while (n > 0) { n -= arr[idx]; idx++; month++; } System.out.println(month); } }