結果

問題 No.688 E869120 and Constructing Array 2
コンテスト
ユーザー Mcpu3
提出日時 2018-09-30 18:10:30
言語 C(gnu17)
(gcc 15.3.0)
コンパイル:
gcc-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
+ 95µs
コード長 424 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 207 ms
コンパイル使用メモリ 42,596 KB
実行使用メモリ 9,920 KB
最終ジャッジ日時 2026-10-31 09:29:24
合計ジャッジ時間 1,652 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <math.h>

int main(void)
{
    int K, i, j, k, l;
    scanf("%d", &K);
    for (i = 1; i <= 30; ++i) {
        for (j = 0; j <= 30 - i; ++j) {
            if ((i - 1) * i / 2 * (int)pow(2, j) == K) break;
        }
        if (j != 31 - i) break;
    }
    printf("%d\n", i + j);
    for (k = 0; k < i; ++k) printf("1 ");
    for (l = 0; l < j; ++l) printf("0 ");
    return 0;
}
0