結果

問題 No.374 コイン
ユーザー 紙ぺーぱー紙ぺーぱー
提出日時 2016-06-03 00:10:38
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 890 bytes
コンパイル時間 926 ms
コンパイル使用メモリ 107,904 KB
実行使用メモリ 19,072 KB
最終ジャッジ日時 2024-04-16 23:25:14
合計ジャッジ時間 3,083 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
19,072 KB
testcase_01 AC 28 ms
18,816 KB
testcase_02 AC 28 ms
19,072 KB
testcase_03 AC 28 ms
18,816 KB
testcase_04 AC 28 ms
18,944 KB
testcase_05 AC 28 ms
18,944 KB
testcase_06 AC 28 ms
18,816 KB
testcase_07 AC 27 ms
18,688 KB
testcase_08 AC 28 ms
18,944 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 28 ms
18,944 KB
testcase_13 AC 28 ms
19,072 KB
testcase_14 AC 28 ms
18,816 KB
testcase_15 AC 28 ms
18,944 KB
testcase_16 AC 28 ms
19,072 KB
testcase_17 AC 27 ms
18,944 KB
testcase_18 AC 29 ms
18,816 KB
testcase_19 AC 28 ms
18,816 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 28 ms
18,816 KB
testcase_24 AC 28 ms
18,816 KB
testcase_25 AC 27 ms
18,944 KB
testcase_26 RE -
testcase_27 AC 28 ms
18,816 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class prog
{
  //制約は1<=A,B<16^8?
  //コインどうしが接するのは良い?
  static void Main()
  {
    var a=Console.ReadLine().Split().Select(int.Parse).ToArray().ValidateArray(x=>1<=x&&x<4294967296);
    a.Validate(x=>x.Length==2);
    Console.ReadLine().Validate(x=>x==null);
    var u=a[0];
    var v=a[1];
    if(u<v)Console.WriteLine("K");
    else Console.WriteLine("S");
  }
}

static public class Validator
{
    static public T Validate<T>(this T input, Func<T, bool> f)
    {
        if (!f(input))
            throw new Exception("invalid input");
        return input;
    }
    static public T[] ValidateArray<T>(this T[] input, Func<T, bool> f)
    {
        foreach (var x in input)
            if (!f(x))
                throw new Exception("invalid input");
        return input;
    }
}
0