結果

問題 No.688 E869120 and Constructing Array 2
ユーザー mmn15277198mmn15277198
提出日時 2021-02-06 14:25:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 872 bytes
コンパイル時間 676 ms
コンパイル使用メモリ 73,620 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-15 21:08:19
合計ジャッジ時間 3,355 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int k;
    cin >> k;
    vector<vector<int>> a(35 , vector<int>(35 , 0));
    for(int i = 2; i < 35; i++){
        a[i][0] = i * (i - 1) / 2;
    }
    for(int i = 2; i < 35; i++){
        for(int j = 1; j < 35; j++){
            a[i][j] = a[i][j - 1] * 2;
        }
    }
    
    vector<int> ans;
    int cnt_0 = 0 , cnt_1 = 0;
    for(int i = 2; i < 35; i++){
        for(int j = 0; j < 35; j++){
            if(a[i][j] == k){
                cnt_0 = j;
                cnt_1 = i;
                //cout << cnt_0 << " : " << cnt_1 << endl;
                break;
            }
        }
    }
    for(int i = 0; i < cnt_0; i++){
        cout << "0" << " ";
    }
    for(int i = 0; i < cnt_1; i++){
        cout << "1" << " ";
    }
    cout << endl;
    
    return 0;
}
0