結果

問題 No.7 プライムナンバーゲーム
ユーザー tabataba
提出日時 2024-07-30 10:32:25
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 867 bytes
コンパイル時間 12,334 ms
コンパイル使用メモリ 401,600 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-30 10:32:40
合計ジャッジ時間 13,379 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
6,940 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
6,940 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `proconio::marker::Chars`
 --> src/main.rs:1:5
  |
1 | use proconio::marker::Chars;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: function `proc` is never used
  --> src/main.rs:20:4
   |
20 | fn proc(n: u64) -> u64 {
   |    ^^^^
   |
   = note: `#[warn(dead_code)]` on by default

ソースコード

diff #

use proconio::marker::Chars;

fn main() {
    proconio::input! {
        n: u64,
    }
    let mut table = [false; 10001];
    table
        .iter_mut()
        .skip(2)
        .zip(PRIME.iter())
        .for_each(|(a, b)| *a = *b);
    if table[n as usize] {
        println!("Win");
    } else {
        println!("Lose");
    }
}

fn proc(n: u64) -> u64 {
    (n / 3 + n / 5) * 2
}

const PRIME: [bool; 10001] = create_prime();
const fn create_prime<const N: usize>() -> [bool; N] {
    let mut table = [true; N];
    table[0] = false;
    table[1] = false;
    let mut i = 2;
    while i < N {
        if table[i] {
            let mut j = i * 2;
            while j < N {
                table[j] = false;
                j += i;
            }
        }
        i += 1;
    }
    table
}

#[cfg(test)]
mod test {
    use super::*;
    #[test]
    fn test() {}
}
0