結果

問題 No.796 well known
ユーザー kami_apk
提出日時 2019-04-26 11:58:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 63,496 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-24 02:46:49
合計ジャッジ時間 1,601 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    int N;
    cin >> N;

    // degree
    vector<int> D;
    D.push_back(3);

    for(int i = 1; i< N-1; i++){
        D.push_back(1);
    }
    int sum = 0;
    for(int i = 0; i<N-1;i++) {
        sum += D[i];
    }
    if(sum % 3 == 1){
        D.push_back(3);
    }else if(sum % 3 == 2){
        D.push_back(2);
    }else if(sum % 3 == 0){
        D.push_back(1);
    }

    for(int i = 0;i< N ;i++) {
        cout << D[i] << " ";
    }
    cout << endl;


    
    return 0;
}
0