結果
問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
ユーザー |
![]() |
提出日時 | 2021-02-09 08:44:56 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 430 bytes |
コンパイル時間 | 1,651 ms |
コンパイル使用メモリ | 73,732 KB |
実行使用メモリ | 41,448 KB |
最終ジャッジ日時 | 2024-07-06 14:12:18 |
合計ジャッジ時間 | 5,309 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 WA * 6 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int ans; if (k == 0 || k > n) { ans = 0; } else if (k % 2 == 1 && (n + 1) / 2 == k) { ans = n - 1; } else { ans = n - 2; } System.out.println(ans); } }