結果

問題 No.548 国士無双
ユーザー t8m8⛄️
提出日時 2017-08-12 16:25:01
言語 Ruby
(3.4.1)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 32 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-09-17 13:43:10
合計ジャッジ時間 2,664 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s = gets.chop
map = Hash.new
s.chars.each do |c|
    unless 'a' <= c and c <= 'm'
        puts "Impossible"
        exit
    end
    if map.has_key?(c)
        map[c] = map[c] + 1
    else
        map[c] = 1
    end
end

if map.size == 13
    "abcdefghijklm".chars.each do |c|
        puts c
    end
elsif map.size == 12
    "abcdefghijklm".chars.each do |c|
        unless map.has_key?(c)
            puts c
        end
    end
else
    puts "Impossible"
end
0