結果

問題 No.688 E869120 and Constructing Array 2
ユーザー nikutto_
提出日時 2018-10-03 11:46:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 499 bytes
コンパイル時間 1,680 ms
コンパイル使用メモリ 167,008 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 10:15:21
合計ジャッジ時間 2,332 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    int k;
    cin>>k;
    for(int n=0;n<=30;n++){
        for(int m=0;m<=30-n;m++){
            if(n+m==0) continue;
            if((1LL<<m)*n*(n-1)/2==k){
                cout<<n+m<<endl;
                for(int i=0;i<n+m;i++){
                    if(i<m) cout<<0;
                    else cout<<1;
                    cout<<(i+1==n+m ? "\n" : " ");
                }
                return 0;
            }
        }
    }
    return 0;
}
0