結果

問題 No.688 E869120 and Constructing Array 2
ユーザー tnakao0123tnakao0123
提出日時 2018-05-19 18:45:25
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 969 bytes
コンパイル時間 2,550 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-21 20:31:53
合計ジャッジ時間 4,792 ms
ジャッジサーバーID
(参考情報)
judge14 / 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 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 688.cc: No.688 E869120 and Constructing Array 2 - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 30;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int k;
  scanf("%d", &k);

  int n, m;
  bool found = false;
  for (n = 2; n <= MAX_N; n++) {
    for (m = 2; m <= n; m++) {
      int d = m * (m - 1) / 2 * (1 << (n - m));
      if (d == k) {
	found = true;
	break;
      }
    }
    if (found) break;
  }
  //printf("n=%d, m=%d\n", n, m);

  for (int i = 0; i < n; i++) {
    if (i) putchar(' ');
    printf("%d", i < m ? 1 : 0);
  }
  putchar('\n');

  return 0;
}
0