結果

問題 No.3356 A÷B問題
コンテスト
ユーザー yuuDot
提出日時 2025-11-15 14:34:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,412 KB
実行使用メモリ 54,072 KB
最終ジャッジ日時 2025-11-15 14:34:11
合計ジャッジ時間 2,855 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = map(int, input().split())
ans = []
is_m = False
if a < 0:
    is_m = True
    a *= -1

a = str(a)
digit = 0
crr = 0
while digit < len(a):
    crr *= 10
    crr += int(a[digit])
    digit += 1
    d, crr = divmod(crr, b)
    if d == 0:
        if len(ans) != 0:
            ans.append("0")
    else:
        ans.append(str(d))

if len(ans) == 0:
    ans.append("0")
ans.append(".")
while crr > 0:
    crr *= 10
    d, crr = divmod(crr, b)
    ans.append(str(d))
ans.append("0")
if is_m:
    ans.insert(0, "-")

print("".join(ans))
0