結果
問題 | No.740 幻の木 |
ユーザー |
|
提出日時 | 2023-11-09 17:20:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 133 ms / 2,000 ms |
コード長 | 1,005 bytes |
コンパイル時間 | 1,954 ms |
コンパイル使用メモリ | 74,684 KB |
実行使用メモリ | 41,292 KB |
最終ジャッジ日時 | 2024-09-26 00:22:59 |
合計ジャッジ時間 | 3,658 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int p = sc.nextInt(); int q = sc.nextInt(); int ans = 0; while(n > 0){ int season = q; for(int i = 1 ; i <= 12 ; i++){ if(i == p){ while(season > 0){ n -= 2 * m; ans++; season--; if(n <= 0){ break; } } i += q - season - 1; } else { n -= m; ans++; } if(n <= 0){ break; } } //System.out.println(n); } System.out.println(ans); } }