結果
問題 | No.740 幻の木 |
ユーザー |
|
提出日時 | 2023-11-09 17:07:52 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 956 bytes |
コンパイル時間 | 2,443 ms |
コンパイル使用メモリ | 74,836 KB |
実行使用メモリ | 41,408 KB |
最終ジャッジ日時 | 2024-09-26 00:22:53 |
合計ジャッジ時間 | 3,871 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 1 |
ソースコード
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--; i++; if(n <= 0){ break; } } } else { n -= m; ans++; } if(n <= 0){ break; } } } System.out.println(ans); } }