結果

問題 No.2558 中国剰余定理
コンテスト
ユーザー neko_the_shadow
提出日時 2024-01-26 18:34:11
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 0 ms / 2,000 ms
+ 845µs
コード長 478 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 428 ms
コンパイル使用メモリ 178,828 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-09-05 14:51:47
合計ジャッジ時間 2,443 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `A` should have a snake case name
 --> src/main.rs:7:9
  |
7 |     let A = tokens.next().unwrap();
  |         ^ help: convert the identifier to snake case: `a`
  |
  = note: `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default

warning: variable `B` should have a snake case name
 --> src/main.rs:8:9
  |
8 |     let B = tokens.next().unwrap();
  |         ^ help: convert the identifier to snake case: `b`

ソースコード

diff #
raw source code

use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let mut tokens = line.trim_end().split_whitespace().map(|v| v.parse::<usize>().unwrap());
    let A = tokens.next().unwrap();
    let B = tokens.next().unwrap();
    let a = tokens.next().unwrap();
    let b = tokens.next().unwrap();

    for y in 0.. {
        let x = y*A + a;
        if x%B == b {
            println!("{}", x);
            break
        }
    }
}
0