結果
問題 | No.25 有限小数 |
ユーザー |
|
提出日時 | 2024-02-06 21:31:42 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 478 bytes |
コンパイル時間 | 4,325 ms |
コンパイル使用メモリ | 175,688 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-28 12:14:27 |
合計ジャッジ時間 | 5,581 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 WA * 1 |
ソースコード
module main;import std;void main(){auto N = readln.chomp.to!ulong;auto M = readln.chomp.to!ulong;if (M == 1uL) {while (N % 10 == 0)N /= 10;writeln(N % 10);return;}while (M % 10 == 0) M /= 10;auto L = M;while (L % 2 == 0) L >>= 1;while (L % 5 == 0) L /= 5;if (L != 1uL) {writeln(-1);return;}BigInt A = N, B = M, Q, R;do {divMod(A, B, Q, R);A = R * 10;} while (R != 0);writeln(Q.toDecimalString().stripRight("0")[$-1]);}