結果
問題 |
No.740 幻の木
|
ユーザー |
![]() |
提出日時 | 2020-12-07 10:11:28 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 122 ms / 2,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 2,011 ms |
コンパイル使用メモリ | 74,824 KB |
実行使用メモリ | 54,176 KB |
最終ジャッジ日時 | 2024-09-17 13:39:21 |
合計ジャッジ時間 | 3,855 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 |
ソースコード
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; } } } }