結果

問題 No.688 E869120 and Constructing Array 2
ユーザー Kutimoti_T
提出日時 2018-05-18 22:28:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 59,352 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 06:48:05
合計ジャッジ時間 1,461 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string> 
#include <set>
using i64 = long long;
using namespace std;

int main(){
  i64 K;
  cin >> K;
  for(i64 a = 0;a <= 30;a++){
    for(i64 b = 0;30 - b - a >= 0;b++){
      i64 A = (a - 1) * a / 2;
      i64 B = (1LL << b);
      if(A * B == K){
        cout << a + b << endl;
        for(int i = 0;i < a;i++) cout << 1 << " ";
        for(int i = 0;i < b;i++) cout << 0 << " \n"[i + 1 == b];
        return 0;
      }
    }
  }
}
0