結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
|
提出日時 | 2024-07-30 10:32:25 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 867 bytes |
コンパイル時間 | 12,334 ms |
コンパイル使用メモリ | 401,600 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-30 10:32:40 |
合計ジャッジ時間 | 13,379 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 10 |
コンパイルメッセージ
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
ソースコード
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() {} }