結果

問題 No.25 有限小数
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-09-01 17:39:09
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-27 14:26:18
合計ジャッジ時間 1,395 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,812 KB
testcase_01 AC 11 ms
6,940 KB
testcase_02 AC 11 ms
6,944 KB
testcase_03 AC 11 ms
6,940 KB
testcase_04 AC 11 ms
6,944 KB
testcase_05 WA -
testcase_06 AC 11 ms
6,940 KB
testcase_07 AC 11 ms
6,940 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 11 ms
6,948 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 11 ms
6,940 KB
testcase_16 AC 11 ms
6,940 KB
testcase_17 AC 11 ms
6,940 KB
testcase_18 AC 12 ms
6,940 KB
testcase_19 AC 11 ms
6,944 KB
testcase_20 AC 11 ms
6,940 KB
testcase_21 AC 11 ms
6,944 KB
testcase_22 WA -
testcase_23 AC 11 ms
6,940 KB
testcase_24 AC 12 ms
6,940 KB
testcase_25 AC 11 ms
6,940 KB
testcase_26 AC 11 ms
6,944 KB
testcase_27 AC 11 ms
6,940 KB
testcase_28 AC 11 ms
6,944 KB
testcase_29 AC 11 ms
6,944 KB
testcase_30 AC 11 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(raw_input())
m = int(raw_input())
tmp = m
cnt2 = 0
cnt5 = 0
while tmp % 2 == 0:
	tmp /= 2
	cnt2 += 1
while tmp % 5 == 0:
	tmp /= 5
	cnt5 += 1

if tmp != 1:
	print -1
else:
	if cnt2 > cnt5:
		n *= 5 * (cnt2 - cnt5)
		m *= 5 * (cnt2 - cnt5)
	elif cnt2 < cnt5:
		n *= 2 * (cnt5 - cnt2)
		m *= 2 * (cnt5 - cnt2)

	n *= 1000000000
	s = str(float(n) / m)

	i = -1
	while s[i] < '1' or '9' < s[i]:
		i -= 1
	print s[i]


0