結果

問題 No.313 π
ユーザー simansiman
提出日時 2021-04-28 10:18:50
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 328 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 11,444 KB
実行使用メモリ 15,900 KB
最終ジャッジ日時 2023-09-21 10:56:01
合計ジャッジ時間 7,301 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
15,572 KB
testcase_01 AC 146 ms
15,836 KB
testcase_02 AC 150 ms
15,644 KB
testcase_03 AC 147 ms
15,728 KB
testcase_04 AC 149 ms
15,632 KB
testcase_05 AC 146 ms
15,808 KB
testcase_06 AC 143 ms
15,592 KB
testcase_07 AC 145 ms
15,820 KB
testcase_08 AC 146 ms
15,588 KB
testcase_09 WA -
testcase_10 AC 150 ms
15,788 KB
testcase_11 AC 148 ms
15,656 KB
testcase_12 AC 145 ms
15,580 KB
testcase_13 AC 149 ms
15,748 KB
testcase_14 AC 144 ms
15,744 KB
testcase_15 AC 147 ms
15,608 KB
testcase_16 AC 145 ms
15,816 KB
testcase_17 WA -
testcase_18 AC 146 ms
15,844 KB
testcase_19 AC 147 ms
15,780 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 146 ms
15,552 KB
testcase_23 AC 148 ms
15,772 KB
testcase_24 WA -
testcase_25 AC 149 ms
15,592 KB
testcase_26 AC 147 ms
15,648 KB
testcase_27 WA -
testcase_28 AC 148 ms
15,556 KB
testcase_29 AC 151 ms
15,560 KB
testcase_30 AC 145 ms
15,720 KB
testcase_31 AC 147 ms
15,624 KB
testcase_32 AC 148 ms
15,652 KB
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

D = [20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841]
S = gets.chomp
counter = Hash.new(0)

S.each_char do |s|
  counter[s] += 1
end

res = [*'0'..'9'].map { |c| counter[c] }
a = -1
b = -1

9.times do |i|
  next if res[i] == D[i]
  a = i if res[i] > D[i]
  b = i if res[i] < D[i]
end

puts [a, b].join(' ')
0