結果
| 問題 |
No.25 有限小数
|
| コンテスト | |
| ユーザー |
char134217728
|
| 提出日時 | 2017-08-24 23:01:56 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 265 bytes |
| コンパイル時間 | 102 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 17,920 KB |
| 最終ジャッジ日時 | 2024-10-15 14:21:35 |
| 合計ジャッジ時間 | 15,190 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 WA * 2 TLE * 2 -- * 5 |
コンパイルメッセージ
Main.rb:20: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
require 'prime'
a = gets.to_i
b = gets.to_i
g = a.gcd(b)
a/=g
b/=g
if(a%b==0)
puts (a/b)%10
exit
end
pd = Prime.prime_division(b).map(&:first)
pd -= [2,5]
if(pd.empty?)
r = a.to_r / b
while r % 1 > 0
r *= 10
end
puts (r % 10).to_i
else
puts -1
end
char134217728