結果

問題 No.227 簡単ポーカー
コンテスト
ユーザー nak2yoshi
提出日時 2016-02-24 11:32:48
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 413 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 249 ms
コンパイル使用メモリ 82,816 KB
最終ジャッジ日時 2026-05-10 04:21:24
合計ジャッジ時間 983 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/functional.d-mixin-227(227): Error: no operator `==` for type `SortedRange`
a == b
  ^
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/range/package.d(11615):        perhaps overload it with `bool opEquals(int[] other) const {}`
struct SortedRange(Range, alias pred = "a < b",
^
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/algorithm/comparison.d(1959): Error: template instance `std.functional.binaryFun!("a == b", "a", "b").binaryFun!(SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted), int[])` error instantiating
            if (predicate(switchExpression, choices[index - 1]()))
                         ^
Main.d(14):        instantiated from here: `predSwitch!("a == b", SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted), int[], string, int[], string, int[], string, int[], string, string)`
    card.values.sort.predSwitch(
                               ^

ソースコード

diff #
raw source code

import std.stdio,
       std.conv,
       std.string,
       std.range,
       std.math,
       std.algorithm;

void main()
{
    auto A = readln.split.to!(int[]);

    int[int] card;
    iota(5).each!(i => card[A[i]]++);
    card.values.sort.predSwitch(
        [2, 3], "FULL HOUSE",
        [1, 1, 3], "THREE CARD",
        [1, 2, 2], "TWO PAIR",
        [1, 1, 1, 2], "ONE PAIR",
        "NO HAND").writeln;
}
0