結果
問題 |
No.1528 Not 1
|
ユーザー |
|
提出日時 | 2022-11-02 20:59:27 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 610 bytes |
コンパイル時間 | 12,732 ms |
コンパイル使用メモリ | 401,508 KB |
実行使用メモリ | 8,704 KB |
最終ジャッジ日時 | 2024-07-17 09:10:54 |
合計ジャッジ時間 | 14,473 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
ソースコード
fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); if n % 2 == 0 { println!("{}", (1..=n/2).map(|i| (2*i).to_string()).collect::<Vec<_>>().join(" ")); return; } if n == 1 { println!("1"); return; } if n < 6 { println!("-1"); return; } let mut result = vec![2, 4]; for i in 4..=n/2 { result.push(i*2); } result.push(6); result.push(3); println!("{}", result.iter().map(|&v| v.to_string()).collect::<Vec<_>>().join(" ")); }