結果
| 問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2017-06-03 14:28:29 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 721 bytes |
| コンパイル時間 | 904 ms |
| コンパイル使用メモリ | 110,464 KB |
| 実行使用メモリ | 26,000 KB |
| 最終ジャッジ日時 | 2024-09-22 04:30:15 |
| 合計ジャッジ時間 | 2,315 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / 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;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
new Magatro().Solve();
}
}
class Magatro
{
private int N, K;
public void Solve()
{
var line = Console.ReadLine().Split(' ');
N = int.Parse(line[0]);
K = int.Parse(line[1]);
if(K == 0 || K > N)
{
Console.WriteLine(0);
return;
}
if (N % 2 == 1 && (N + 1) / 2 == K)
{
Console.WriteLine(N - 1);
return;
}
else
{
Console.WriteLine(N - 2);
return;
}
}
}
mban