結果
| 問題 |
No.2558 中国剰余定理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-02 14:41:28 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 1,119 bytes |
| コンパイル時間 | 12,577 ms |
| コンパイル使用メモリ | 379,188 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-26 17:08:58 |
| 合計ジャッジ時間 | 12,876 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
warning: unused imports: `BTreeSet`, `HashMap`
--> src/main.rs:2:25
|
2 | use std::collections::{ HashMap, BTreeSet };
| ^^^^^^^ ^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: variable `A` should have a snake case name
--> src/main.rs:39:9
|
39 | A: u128,
| ^ help: convert the identifier to snake case: `a`
|
= note: `#[warn(non_snake_case)]` on by default
warning: variable `B` should have a snake case name
--> src/main.rs:40:9
|
40 | B: u128,
| ^ help: convert the identifier to snake case: `b`
ソースコード
use proconio::input;
use std::collections::{ HashMap, BTreeSet };
fn main() {
/*
input! {
n: usize,
q: usize,
mut a: [u128; n],
}
let mut not_include: BTreeSet<u128> = (0..=n).map(|i| i as u128).collect();
let mut counter: HashMap<u128, u128> = (0..=n).map(|i| (i as u128, 0)).collect();
let n = n as u128;
for e in &a {
if e <= &n {
*counter.get_mut(e).unwrap() += 1;
not_include.remove(e);
}
}
for _ in 0..q {
input! {
i: usize,
x: u128,
}
let old = a[i];
*counter.get_mut(&old).unwrap() -= 1;
if *counter.get_mut(&old).unwrap() == 0 {
not_include.insert(old);
}
a[i] = x;
*counter.get_mut(&x).unwrap() += 1;
not_include.remove(&x);
}
*/
input! {
A: u128,
B: u128,
a: u128,
b: u128,
}
for i in 0..=(A * B) {
let maybe_ans = i * A + a;
if maybe_ans % B == b {
println!("{}", maybe_ans);
return;
}
}
}