結果

問題 No.1528 Not 1
ユーザー phsplsphspls
提出日時 2022-11-02 20:59:27
言語 Rust
(1.77.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 4,249 ms
コンパイル使用メモリ 145,424 KB
実行使用メモリ 8,668 KB
最終ジャッジ日時 2023-09-24 08:44:08
合計ジャッジ時間 2,895 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 11 ms
7,216 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 5 ms
4,376 KB
testcase_04 AC 12 ms
7,596 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 8 ms
5,368 KB
testcase_07 AC 12 ms
7,164 KB
testcase_08 AC 6 ms
4,704 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 7 ms
4,564 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 13 ms
7,980 KB
testcase_19 AC 14 ms
8,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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(" "));
}
0