結果
問題 |
No.1464 Number Conversion
|
ユーザー |
![]() |
提出日時 | 2021-11-09 19:57:03 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 502 bytes |
コンパイル時間 | 1,376 ms |
コンパイル使用メモリ | 169,480 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 13:09:29 |
合計ジャッジ時間 | 2,205 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 |
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!ulong.gcdImpl`
ソースコード
import std; void main() { string X = readln.chomp; bool afterDecimalPoint; ulong num, den = 1; foreach (x; X) { if (x == '.') { afterDecimalPoint = true; } else { num = num * 10 + (x - '0'); if (afterDecimalPoint) { den *= 10; } } } if (num > 0) { ulong g = gcd(num, den); num /= g, den /= g; } else { den = 1; } writeln(num, "/", den); }