結果

問題 No.25 有限小数
ユーザー tonyu0
提出日時 2019-12-24 09:22:38
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 14,522 ms
コンパイル使用メモリ 400,180 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-19 20:24:11
合計ジャッジ時間 15,647 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: u128 = itr.next().unwrap().parse().unwrap();
    let m: u128 = itr.next().unwrap().parse().unwrap();

    for i in 0..18 {
        let num: u128 = n * 10u128.pow(i);
        if num % m == 0 {
            let mut ans = num / m;
            while ans % 10 == 0 {
                ans /= 10;
            }
            println!("{}", ans % 10);
            return;
        }
    }
    println!("-1");
}
0