結果

問題 No.313 π
ユーザー LeonardoneLeonardone
提出日時 2015-12-07 01:27:39
言語 Ruby
(3.3.0)
結果
AC  
実行時間 151 ms / 5,000 ms
コード長 437 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 11,572 KB
実行使用メモリ 15,696 KB
最終ジャッジ日時 2023-10-12 19:26:08
合計ジャッジ時間 6,591 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
15,636 KB
testcase_01 AC 144 ms
15,364 KB
testcase_02 AC 144 ms
15,476 KB
testcase_03 AC 144 ms
15,492 KB
testcase_04 AC 145 ms
15,360 KB
testcase_05 AC 144 ms
15,568 KB
testcase_06 AC 144 ms
15,460 KB
testcase_07 AC 145 ms
15,452 KB
testcase_08 AC 144 ms
15,420 KB
testcase_09 AC 145 ms
15,352 KB
testcase_10 AC 145 ms
15,548 KB
testcase_11 AC 144 ms
15,428 KB
testcase_12 AC 143 ms
15,644 KB
testcase_13 AC 143 ms
15,696 KB
testcase_14 AC 144 ms
15,476 KB
testcase_15 AC 144 ms
15,612 KB
testcase_16 AC 143 ms
15,620 KB
testcase_17 AC 144 ms
15,628 KB
testcase_18 AC 144 ms
15,620 KB
testcase_19 AC 144 ms
15,576 KB
testcase_20 AC 144 ms
15,600 KB
testcase_21 AC 144 ms
15,356 KB
testcase_22 AC 144 ms
15,476 KB
testcase_23 AC 148 ms
15,524 KB
testcase_24 AC 144 ms
15,624 KB
testcase_25 AC 145 ms
15,472 KB
testcase_26 AC 145 ms
15,472 KB
testcase_27 AC 145 ms
15,616 KB
testcase_28 AC 145 ms
15,440 KB
testcase_29 AC 145 ms
15,596 KB
testcase_30 AC 151 ms
15,472 KB
testcase_31 AC 146 ms
15,464 KB
testcase_32 AC 145 ms
15,548 KB
testcase_33 AC 144 ms
15,448 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#! ruby
# yukicoder My Practice
# author: Leonardone @ NEETSDKASU

# 解説読後
# http://yukicoder.me/problems/686/editorial

s = gets

a = [0] * 10

s.each_char do |c|
    next if c == '.'
    a[c.to_i] += 1
end

b = [20105, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841]

w = -1
c = -1

10.times do |i|
    d = b[i] - a[i]
    if d > 0
        c = i
    elsif d < 0
        w = i
    end
end

puts "%d %d" % [w, c]


0