結果

問題 No.587 七対子
ユーザー tanukidon
提出日時 2018-04-02 22:09:15
言語 Ruby
(3.4.1)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 202 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-19 19:51:58
合計ジャッジ時間 4,258 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:16: warning: `elsif' at the end of line without an expression
Syntax OK

ソースコード

diff #

s = gets.chomp
h = Hash.new(0)
s.scan(/./){|i| h[i] += 1}
j = 0
m = 0
h.each do |k,v|
  if v > 2
    j += 2
  elsif v == 1
    j += 1
    m = k
  end
end
if j == 1
  puts m
elsif
  puts "Impossible"
end
0