結果

問題 No.374 コイン
ユーザー 紙ぺーぱー紙ぺーぱー
提出日時 2016-06-02 18:53:03
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 1,000 ms
コード長 892 bytes
コンパイル時間 3,243 ms
コンパイル使用メモリ 105,308 KB
実行使用メモリ 23,988 KB
最終ジャッジ日時 2023-08-07 17:38:25
合計ジャッジ時間 6,120 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
21,764 KB
testcase_01 AC 58 ms
21,860 KB
testcase_02 AC 58 ms
21,972 KB
testcase_03 AC 58 ms
22,052 KB
testcase_04 AC 58 ms
21,940 KB
testcase_05 AC 58 ms
23,800 KB
testcase_06 AC 58 ms
23,800 KB
testcase_07 AC 57 ms
23,812 KB
testcase_08 AC 57 ms
20,016 KB
testcase_09 AC 57 ms
21,868 KB
testcase_10 AC 58 ms
19,772 KB
testcase_11 AC 58 ms
23,804 KB
testcase_12 AC 58 ms
21,744 KB
testcase_13 AC 57 ms
19,844 KB
testcase_14 AC 58 ms
23,848 KB
testcase_15 AC 58 ms
23,828 KB
testcase_16 AC 59 ms
21,964 KB
testcase_17 AC 58 ms
21,852 KB
testcase_18 AC 59 ms
23,920 KB
testcase_19 AC 59 ms
22,048 KB
testcase_20 AC 59 ms
21,988 KB
testcase_21 AC 59 ms
23,804 KB
testcase_22 AC 59 ms
19,904 KB
testcase_23 AC 58 ms
19,860 KB
testcase_24 AC 58 ms
21,920 KB
testcase_25 AC 58 ms
21,812 KB
testcase_26 AC 58 ms
23,988 KB
testcase_27 AC 57 ms
19,888 KB
testcase_28 AC 57 ms
21,820 KB
testcase_29 AC 57 ms
21,816 KB
testcase_30 AC 58 ms
19,804 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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(long.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