結果
| 問題 | No.1464 Number Conversion | 
| コンテスト | |
| ユーザー |  kokatsu | 
| 提出日時 | 2021-11-09 19:49:04 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 462 bytes | 
| コンパイル時間 | 1,538 ms | 
| コンパイル使用メモリ | 172,204 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-22 13:09:23 | 
| 合計ジャッジ時間 | 2,452 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;
            }
        }
    }
    ulong g = gcd(num, den);
    if (g > 0) {
        num /= g, den /= g;
    }
    writeln(num, "/", den);
}
            
            
            
        