結果
| 問題 | No.521 Cheeses and a Mousetrap(チーズとネズミ捕り) |
| コンテスト | |
| ユーザー |
muz_808
|
| 提出日時 | 2017-06-02 22:26:29 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 1,330 bytes |
| コンパイル時間 | 788 ms |
| コンパイル使用メモリ | 111,812 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2024-09-21 22:26:48 |
| 合計ジャッジ時間 | 2,189 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Text;
using System.Linq;
using System.Collections.Generic;
class Program
{
private static readonly Scanner sc = new Scanner();
static void Main(string[] args)
{
int n = sc.Int;
int k = sc.Int;
if (k == 0 || k > n)
{
Console.WriteLine(0);
}
else
{
Console.WriteLine(n % 2 == 1 && n / 2 + 1 == k ? n-1 : n-2);
}
}
}
class Scanner
{
private string[] _str = new string[0];
private int _i;
public string Line { get { return Console.ReadLine(); } }
public string Str
{
get
{
if (_i >= _str.Length)
{
_str = Line.Split(' ');
_i = 0;
}
return _str[_i++];
}
}
public string[] StrArr { get { return Line.Split(' '); } }
public int Int { get { return int.Parse(Str); } }
public int[] IntArr { get { return Line.Split(' ').Select(int.Parse).ToArray(); } }
public long Long { get { return long.Parse(Str); } }
public long[] LongArr { get { return Line.Split(' ').Select(long.Parse).ToArray(); } }
public double Double { get { return double.Parse(Str); } }
public double[] DoubleArr { get { return Line.Split(' ').Select(double.Parse).ToArray(); } }
}
muz_808