結果

問題 No.688 E869120 and Constructing Array 2
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2018-08-14 18:59:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 909 bytes
コンパイル時間 955 ms
コンパイル使用メモリ 93,708 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-24 17:10:52
合計ジャッジ時間 3,094 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    long long K;
    cin >> K;

    for ( int i = 1; i <= 30; i++ ) {
        for ( int j = 0; j <= i; j++ ) {
            long long a = ( j > 0 )  ? j*(j-1)/2 : 0;
            if ( a * (1<<(i-j)) == K ) {
                string ans = "";
                for ( int x = 0; x < j; x++ ) {
                    ans += "1 ";
                }
                for ( int x = 0; x < (i-j); x++ ) {
                    ans += "0 ";
                }
                cout << ans.substr(0,ans.length()-1) << endl;

                return 0;
            }
        }
    }

    return 0;
}
0