結果

問題 No.548 国士無双
ユーザー naotest2naotest2
提出日時 2017-09-08 16:43:36
言語 Ruby
(3.2.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 378 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 11,396 KB
実行使用メモリ 15,312 KB
最終ジャッジ日時 2023-09-19 08:42:41
合計ジャッジ時間 3,275 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,044 KB
testcase_01 AC 84 ms
15,224 KB
testcase_02 AC 85 ms
15,248 KB
testcase_03 AC 83 ms
15,168 KB
testcase_04 AC 87 ms
15,252 KB
testcase_05 AC 84 ms
15,304 KB
testcase_06 AC 82 ms
15,052 KB
testcase_07 AC 84 ms
15,048 KB
testcase_08 AC 84 ms
15,192 KB
testcase_09 AC 84 ms
15,244 KB
testcase_10 AC 84 ms
15,252 KB
testcase_11 AC 84 ms
15,048 KB
testcase_12 AC 83 ms
15,172 KB
testcase_13 AC 84 ms
14,976 KB
testcase_14 AC 84 ms
15,176 KB
testcase_15 AC 83 ms
15,128 KB
testcase_16 AC 83 ms
15,196 KB
testcase_17 AC 85 ms
15,268 KB
testcase_18 AC 82 ms
15,024 KB
testcase_19 AC 84 ms
15,024 KB
testcase_20 WA -
testcase_21 AC 84 ms
15,200 KB
testcase_22 WA -
testcase_23 AC 85 ms
15,104 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

S=gets.chomp

h = {}
97.upto(97+12) do |i|
  h[i.chr] = 0
end
(S.length).times do |i|
  if !h.key?(S[i])
    puts 'Impossible'
    exit
  end
  h[S[i]] = h[S[i]] + 1
end
found = false
h.each do |k,v|
  if v > 2 then
    puts 'Impossible'
    found = true
    break
  elsif v == 0
    puts k
    found = true
    break
  end
end

if !found
  h.each do |k,v|
    puts k
  end
end
0