結果

問題 No.1004 サイコロの実装 (2)
ユーザー iwot
提出日時 2020-05-31 18:09:33
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 518 bytes
コンパイル時間 11,234 ms
コンパイル使用メモリ 386,508 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-17 22:20:16
合計ジャッジ時間 12,548 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `a`
  --> src/main.rs:16:11
   |
16 | fn no1004(a:usize, b:usize, x0:usize, n:usize) -> (usize, usize) {
   |           ^ help: if this is intentional, prefix it with an underscore: `_a`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `b`
  --> src/main.rs:16:20
   |
16 | fn no1004(a:usize, b:usize, x0:usize, n:usize) -> (usize, usize) {
   |                    ^ help: if this is intentional, prefix it with an underscore: `_b`

ソースコード

diff #

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
  let input:Vec<usize> = read_vec();
  let result = no1004(input[0], input[1], input[2], input[3]);
  println!("{} {}", result.0, result.1);
}

fn no1004(a:usize, b:usize, x0:usize, n:usize) -> (usize, usize) {
  if x0 % 2 == 0 {
    (0, n / 2)
  } else {
    (n / 2, 0)
  }
}
0