結果

問題 No.25 有限小数
ユーザー tonyu0tonyu0
提出日時 2019-12-24 09:22:38
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 8,331 ms
コンパイル使用メモリ 159,300 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 00:34:59
合計ジャッジ時間 2,621 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 0 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,348 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 0 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 0 ms
4,348 KB
testcase_25 AC 0 ms
4,348 KB
testcase_26 AC 1 ms
4,348 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

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