結果

問題 No.25 有限小数
ユーザー simansiman
提出日時 2021-11-17 15:40:28
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 188 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 11,204 KB
実行使用メモリ 15,268 KB
最終ジャッジ日時 2023-08-25 03:37:16
合計ジャッジ時間 4,293 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,056 KB
testcase_01 AC 79 ms
15,064 KB
testcase_02 AC 79 ms
15,268 KB
testcase_03 AC 79 ms
15,056 KB
testcase_04 AC 79 ms
15,156 KB
testcase_05 AC 78 ms
15,056 KB
testcase_06 AC 78 ms
15,196 KB
testcase_07 AC 80 ms
15,100 KB
testcase_08 AC 80 ms
15,148 KB
testcase_09 AC 80 ms
15,084 KB
testcase_10 AC 80 ms
15,124 KB
testcase_11 AC 80 ms
15,068 KB
testcase_12 AC 80 ms
15,104 KB
testcase_13 AC 79 ms
15,236 KB
testcase_14 AC 79 ms
15,000 KB
testcase_15 AC 80 ms
15,260 KB
testcase_16 AC 79 ms
15,064 KB
testcase_17 AC 80 ms
15,196 KB
testcase_18 AC 80 ms
15,104 KB
testcase_19 AC 81 ms
15,136 KB
testcase_20 AC 80 ms
15,096 KB
testcase_21 AC 80 ms
15,104 KB
testcase_22 AC 78 ms
15,120 KB
testcase_23 AC 76 ms
15,152 KB
testcase_24 AC 77 ms
15,104 KB
testcase_25 AC 78 ms
15,240 KB
testcase_26 AC 79 ms
15,080 KB
testcase_27 AC 77 ms
15,008 KB
testcase_28 AC 79 ms
15,080 KB
testcase_29 AC 77 ms
15,200 KB
testcase_30 AC 77 ms
15,248 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:14: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

N = gets.to_i
M = gets.to_i

cnt = 0
n = N
while n % M != 0 && cnt < 100
  n *= 10
  cnt += 1
end

if n % M == 0
  puts (n / M).to_s.reverse.chars.find { |c| c != '0' }
else
  puts -1
end
0