結果

問題 No.548 国士無双
ユーザー mai
提出日時 2017-07-28 22:28:07
言語 Ruby
(3.4.1)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-09-17 12:57:20
合計ジャッジ時間 2,752 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def ascan; gets.split.map(&:to_i); end
def scan; gets.to_i; end


a = gets.chomp

f = false
"a".upto("m"){|c|
    b = (a+c).chars.sort
    h = {}
    b.each{|e| h[e]||=0; h[e]+=1}
    j = {}
    h.values.each{|e| j[e]||=0; j[e]+=1}
    if j[1] == 12 && j[2] == 1
        puts c
        f = true
    end
}

unless f
    puts "Impossible"
end
0