結果

問題 No.1528 Not 1
ユーザー 👑 CleyL
提出日時 2022-01-26 00:14:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 648 bytes
コンパイル時間 752 ms
コンパイル使用メモリ 64,992 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-17 20:58:36
合計ジャッジ時間 2,911 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
    int n;cin>>n;
    if(n ==3 || n == 5){
        cout << -1 << endl;
    }else if(n >= 6){
        int nw = 2;
        for(int i = 0; (n+1)/2-2 > i; i++){
            cout << nw;
            if(i+1 != (n+1)/2-2)cout << " ";
            nw += 2;
            if(nw == 6)nw += 2;
        }
        cout << " " << 6 << " " << 3 << endl;
    }else if(n != 1){
        int nw = 2;
        for(int i = 0; (n+1)/2 > i; i++){
            cout << nw;
            if(i+1 != (n+1)/2)cout << " ";
            nw += 2;
        }
        cout << endl;
    }else if(n == 1){
        cout << 1 << endl;
    }
}
0