結果

問題 No.1926 Sequence of Remainders
ユーザー ixTL255ixTL255
提出日時 2023-02-12 19:42:24
言語 Rust
(1.77.0)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 2,295 ms
コンパイル使用メモリ 150,256 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-23 06:44:29
合計ジャッジ時間 16,721 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 149 ms
4,384 KB
testcase_02 AC 144 ms
4,380 KB
testcase_03 AC 145 ms
4,504 KB
testcase_04 AC 146 ms
4,384 KB
testcase_05 AC 147 ms
4,388 KB
testcase_06 AC 158 ms
4,380 KB
testcase_07 AC 158 ms
4,508 KB
testcase_08 AC 157 ms
4,384 KB
testcase_09 AC 160 ms
4,508 KB
testcase_10 AC 157 ms
4,384 KB
testcase_11 AC 159 ms
4,388 KB
testcase_12 AC 157 ms
4,380 KB
testcase_13 AC 157 ms
4,380 KB
testcase_14 AC 159 ms
4,380 KB
testcase_15 AC 156 ms
4,380 KB
testcase_16 AC 159 ms
4,380 KB
testcase_17 AC 157 ms
4,380 KB
testcase_18 AC 158 ms
4,384 KB
testcase_19 AC 157 ms
4,380 KB
testcase_20 AC 158 ms
4,384 KB
testcase_21 AC 158 ms
4,384 KB
testcase_22 AC 158 ms
4,388 KB
testcase_23 AC 156 ms
4,380 KB
testcase_24 AC 159 ms
4,384 KB
testcase_25 AC 154 ms
4,384 KB
testcase_26 AC 159 ms
4,388 KB
testcase_27 AC 160 ms
4,384 KB
testcase_28 AC 157 ms
4,384 KB
testcase_29 AC 157 ms
4,384 KB
testcase_30 AC 158 ms
4,384 KB
testcase_31 AC 159 ms
4,380 KB
testcase_32 AC 159 ms
4,380 KB
testcase_33 AC 155 ms
4,384 KB
testcase_34 AC 155 ms
4,384 KB
testcase_35 AC 160 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable does not need to be mutable
  --> Main.rs:12:13
   |
12 |         let mut n: usize = itr.next().unwrap().parse().unwrap();
   |             ----^
   |             |
   |             help: remove this `mut`
   |
   = note: `#[warn(unused_mut)]` on by default

warning: variable does not need to be mutable
  --> Main.rs:13:13
   |
13 |         let mut m: usize = itr.next().unwrap().parse().unwrap();
   |             ----^
   |             |
   |             help: remove this `mut`

warning: variable does not need to be mutable
  --> Main.rs:14:13
   |
14 |         let mut k: usize = itr.next().unwrap().parse().unwrap();
   |             ----^
   |             |
   |             help: remove this `mut`

warning: unused `Result` that must be used
  --> Main.rs:10:9
   |
10 |         io::stdin().read_line(&mut s);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this `Result` may be an `Err` variant, which should be handled
   = note: `#[warn(unused_must_use)]` on by default

warning: 4 warnings emitted

ソースコード

diff #

use std::io;

fn main() {
    let mut n = String::new();
    io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();

    for _ in 0..n {
        let mut s = String::new();
        io::stdin().read_line(&mut s);
        let mut itr = s.trim().split_whitespace();
        let mut n: usize = itr.next().unwrap().parse().unwrap();
        let mut m: usize = itr.next().unwrap().parse().unwrap();
        let mut k: usize = itr.next().unwrap().parse().unwrap();

        let a = k % m;
        println!("{}",
            if a < m - n { a }
            else { 0 }
        );
    }
}
0