結果
| 問題 |
No.219 巨大数の概算
|
| コンテスト | |
| ユーザー |
小指が強い人
|
| 提出日時 | 2015-11-16 23:14:37 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 194 ms / 1,500 ms |
| コード長 | 676 bytes |
| コンパイル時間 | 48 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-07-18 11:46:48 |
| 合計ジャッジ時間 | 11,248 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 51 |
コンパイルメッセージ
Main.rb:7: warning: assigned but unused variable - c Main.rb:12: warning: assigned but unused variable - qc 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
小指が強い人