結果
| 問題 | No.219 巨大数の概算 |
| コンテスト | |
| ユーザー |
小指が強い人
|
| 提出日時 | 2015-11-16 23:14:37 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 186 ms / 1,500 ms |
| コード長 | 676 bytes |
| 記録 | |
| コンパイル時間 | 234 ms |
| コンパイル使用メモリ | 9,088 KB |
| 実行使用メモリ | 29,824 KB |
| 最終ジャッジ日時 | 2026-04-02 04:15:32 |
| 合計ジャッジ時間 | 10,341 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 51 |
コンパイルメッセージ
Main.rb:12: warning: assigned but unused variable - qc Main.rb:7: warning: assigned but unused variable - c Syntax OK
ソースコード
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
小指が強い人