結果

問題 No.3260 岩井スターグラフ
ユーザー yiwiy9
提出日時 2025-09-06 13:23:42
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 351 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 14,175 ms
コンパイル使用メモリ 379,420 KB
実行使用メモリ 9,976 KB
最終ジャッジ日時 2025-09-06 13:24:35
合計ジャッジ時間 25,087 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `x`
 --> src/main.rs:5:9
  |
5 |         x: i64,
  |         ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

ソースコード

diff #

use proconio::input;

fn main() {
    input! {
        x: i64,
        y: i64,
        n: usize,
        uv: [(i64, i64); n],
    }

    for &(u, v) in &uv {
        if u == 0 {
            println!("{}", if v % y == 0 { y } else { v % y });
        } else if (u - 1) / y == (v - 1) / y {
            println!("{}", v - u);
        } else {
            let u_0 = if u % y == 0 { y } else { u % y };
            let v_0 = if v % y == 0 { y } else { v % y };
            println!("{}", u_0 + v_0);
        }
    }
}
0