結果

問題 No.219 巨大数の概算
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-16 23:14:37
言語 Ruby
(3.3.0)
結果
AC  
実行時間 218 ms / 1,500 ms
コード長 676 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 11,324 KB
実行使用メモリ 15,480 KB
最終ジャッジ日時 2023-09-25 14:58:34
合計ジャッジ時間 14,292 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 214 ms
15,340 KB
testcase_01 AC 216 ms
15,268 KB
testcase_02 AC 216 ms
15,300 KB
testcase_03 AC 215 ms
15,268 KB
testcase_04 AC 218 ms
15,424 KB
testcase_05 AC 79 ms
15,368 KB
testcase_06 AC 93 ms
15,152 KB
testcase_07 AC 82 ms
15,108 KB
testcase_08 AC 93 ms
15,280 KB
testcase_09 AC 80 ms
15,076 KB
testcase_10 AC 211 ms
15,432 KB
testcase_11 AC 217 ms
15,328 KB
testcase_12 AC 216 ms
15,268 KB
testcase_13 AC 210 ms
15,460 KB
testcase_14 AC 213 ms
15,192 KB
testcase_15 AC 212 ms
15,404 KB
testcase_16 AC 210 ms
15,204 KB
testcase_17 AC 209 ms
15,380 KB
testcase_18 AC 210 ms
15,028 KB
testcase_19 AC 212 ms
15,264 KB
testcase_20 AC 213 ms
15,480 KB
testcase_21 AC 211 ms
15,428 KB
testcase_22 AC 216 ms
15,200 KB
testcase_23 AC 212 ms
15,272 KB
testcase_24 AC 211 ms
15,444 KB
testcase_25 AC 210 ms
15,272 KB
testcase_26 AC 212 ms
15,200 KB
testcase_27 AC 213 ms
15,380 KB
testcase_28 AC 211 ms
15,236 KB
testcase_29 AC 212 ms
15,408 KB
testcase_30 AC 210 ms
15,144 KB
testcase_31 AC 213 ms
15,424 KB
testcase_32 AC 211 ms
15,228 KB
testcase_33 AC 208 ms
15,332 KB
testcase_34 AC 214 ms
15,256 KB
testcase_35 AC 212 ms
15,336 KB
testcase_36 AC 215 ms
15,232 KB
testcase_37 AC 213 ms
15,264 KB
testcase_38 AC 214 ms
15,448 KB
testcase_39 AC 212 ms
15,412 KB
testcase_40 AC 209 ms
15,288 KB
testcase_41 AC 210 ms
15,152 KB
testcase_42 AC 213 ms
15,400 KB
testcase_43 AC 218 ms
15,436 KB
testcase_44 AC 214 ms
15,424 KB
testcase_45 AC 212 ms
15,356 KB
testcase_46 AC 212 ms
15,460 KB
testcase_47 AC 207 ms
15,428 KB
testcase_48 AC 214 ms
15,444 KB
testcase_49 AC 211 ms
15,272 KB
testcase_50 AC 212 ms
15,428 KB
testcase_51 AC 84 ms
15,144 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: assigned but unused variable - c
Main.rb:12: warning: assigned but unused variable - qc
Syntax OK

ソースコード

diff #

n = gets.to_i
m = 5
lim = 10 ** m
n.times do |t|
    str = gets.split
    a = str[0].to_i
    c = b = str[1].to_i
    x = a.to_f
    q = 1.0
    count = 0
    xc = 0
    qc = 0
    while b > 0 do
        if b % 2 == 0
            while x >= lim do
                x /= lim
                xc += m
            end
            x *= x
            xc += xc
            b >>= 1
        else
            q *= x
            while q >= lim do
                q /= lim
                count += m
            end
            count += xc 
            b -= 1 
        end
    end
    num = (q * 10).to_i.to_s
    e = count + num.length - 2
    print num[0], " ", num[1], " ", e, "\n"
end
0