結果

問題 No.587 七対子
ユーザー simansiman
提出日時 2020-05-08 00:35:48
言語 Ruby
(3.2.2)
結果
WA  
実行時間 -
コード長 254 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 11,424 KB
実行使用メモリ 15,316 KB
最終ジャッジ日時 2023-09-16 08:15:39
合計ジャッジ時間 4,244 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,224 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 79 ms
15,092 KB
testcase_06 AC 78 ms
15,136 KB
testcase_07 AC 78 ms
15,124 KB
testcase_08 AC 81 ms
15,260 KB
testcase_09 AC 81 ms
15,092 KB
testcase_10 WA -
testcase_11 AC 79 ms
15,076 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 84 ms
15,004 KB
testcase_16 AC 80 ms
15,096 KB
testcase_17 AC 80 ms
14,996 KB
testcase_18 AC 81 ms
15,164 KB
testcase_19 AC 81 ms
15,296 KB
testcase_20 AC 81 ms
15,224 KB
testcase_21 AC 80 ms
15,000 KB
testcase_22 AC 78 ms
15,060 KB
testcase_23 AC 79 ms
15,224 KB
testcase_24 AC 80 ms
15,104 KB
testcase_25 AC 79 ms
15,248 KB
testcase_26 AC 80 ms
15,292 KB
testcase_27 AC 80 ms
15,220 KB
testcase_28 AC 79 ms
15,188 KB
testcase_29 AC 78 ms
15,068 KB
testcase_30 AC 82 ms
15,272 KB
testcase_31 AC 81 ms
15,256 KB
testcase_32 WA -
testcase_33 AC 80 ms
15,076 KB
testcase_34 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

S = gets.chomp

groups = S.chars.tally

success = true
cnt = 0
char = ''

groups.each do |ch, cnt|
  if cnt <= 2
    char = ch if cnt == 1
    cnt += 1
  else
    success = false
  end
end

if success && cnt == 7
  puts char
else
  puts 'Impossible'
end
0