結果

問題 No.313 π
ユーザー simansiman
提出日時 2021-04-28 10:19:21
言語 Ruby
(3.3.0)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 329 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,572 KB
実行使用メモリ 15,824 KB
最終ジャッジ日時 2023-09-21 10:56:36
合計ジャッジ時間 6,630 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
15,700 KB
testcase_01 AC 137 ms
15,640 KB
testcase_02 AC 136 ms
15,588 KB
testcase_03 AC 137 ms
15,548 KB
testcase_04 AC 137 ms
15,796 KB
testcase_05 AC 137 ms
15,572 KB
testcase_06 AC 136 ms
15,724 KB
testcase_07 AC 136 ms
15,632 KB
testcase_08 AC 138 ms
15,824 KB
testcase_09 AC 136 ms
15,768 KB
testcase_10 AC 139 ms
15,688 KB
testcase_11 AC 136 ms
15,556 KB
testcase_12 AC 136 ms
15,764 KB
testcase_13 AC 136 ms
15,544 KB
testcase_14 AC 136 ms
15,792 KB
testcase_15 AC 137 ms
15,568 KB
testcase_16 AC 135 ms
15,632 KB
testcase_17 AC 137 ms
15,744 KB
testcase_18 AC 141 ms
15,564 KB
testcase_19 AC 144 ms
15,796 KB
testcase_20 AC 142 ms
15,740 KB
testcase_21 AC 136 ms
15,592 KB
testcase_22 AC 138 ms
15,756 KB
testcase_23 AC 137 ms
15,772 KB
testcase_24 AC 141 ms
15,780 KB
testcase_25 AC 140 ms
15,584 KB
testcase_26 AC 143 ms
15,600 KB
testcase_27 AC 137 ms
15,632 KB
testcase_28 AC 140 ms
15,564 KB
testcase_29 AC 136 ms
15,784 KB
testcase_30 AC 137 ms
15,820 KB
testcase_31 AC 139 ms
15,628 KB
testcase_32 AC 137 ms
15,636 KB
testcase_33 AC 137 ms
15,592 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

10.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