結果
問題 | No.521 Cheeses and a Mousetrap(チーズとネズミ捕り) |
ユーザー |
![]() |
提出日時 | 2019-03-18 17:00:03 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 596 bytes |
コンパイル時間 | 847 ms |
コンパイル使用メモリ | 111,348 KB |
実行使用メモリ | 19,328 KB |
最終ジャッジ日時 | 2024-07-18 11:36:44 |
合計ジャッジ時間 | 2,504 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; class Program { public void Solve() { int[] NK = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); if (NK[1] == 0 || NK[0] < NK[1]) { Console.WriteLine(0); return; } if (NK[0] % 2 == 1 && NK[0] / 2 + 1 == NK[1]) { Console.WriteLine(NK[0] - 1); return; } Console.WriteLine(NK[0] - 2); } static void Main() { var solver = new Program(); solver.Solve(); } }