結果

問題 No.688 E869120 and Constructing Array 2
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2019-03-07 11:15:30
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 709 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 52,204 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 19:21:57
合計ジャッジ時間 2,907 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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>
using namespace std;

int main(){
    int K,c_0,c_1;
    cin >> K;
    for(c_0 = 0; c_0 == 0 || K % (1 << (c_0 - 1)) == 0; c_0++)
    {
        if (c_0 == 0) {
            for(c_1 = 0; c_1 * (c_1 - 1) < K * 2; c_1++) {}
            if (c_1 * (c_1 - 1) == K * 2) {
                break;
            }
        }
        else {
            for (c_1 = 0; c_1 * (c_1 - 1) < K / (1 << (c_0 - 1)); c_1++) {}
            if (c_1 * (c_1 - 1) == K / (1 << (c_0 - 1))) {
                break;
            }
        }
    }
    for(int i = 0; i < c_0; i++)
    {
        cout << 0 << " ";
    }
    for(int i = 0; i < c_1; i++)
    {
        cout << 1 << " ";
    }
    cout << endl;
    return 0;
}
0