結果
問題 | No.688 E869120 and Constructing Array 2 |
ユーザー | aaa |
提出日時 | 2018-07-18 10:17:51 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
OLE
|
実行時間 | - |
コード長 | 1,205 bytes |
コンパイル時間 | 870 ms |
コンパイル使用メモリ | 93,572 KB |
実行使用メモリ | 8,200 KB |
最終ジャッジ日時 | 2023-08-20 06:40:29 |
合計ジャッジ時間 | 4,334 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
8,200 KB |
testcase_01 | OLE | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
ソースコード
#include <stdio.h> #include <algorithm> #include <iostream> #include <string> #include <vector> #include <functional> #include <map> #include <iomanip> #include <math.h> #include <stack> #include <queue> #include <bitset> #include <cstdlib> #include <tuple> #include <cctype> using namespace std; int main() { long i, j; int k; cin >> k; for (i = 2; i <= 30; i++) { long num = 0; for (int h = i - 1; h >= 1; h--) { num += h; } if (num == k) { for (i; i > 0; j--) { cout << 1; if (i - 1 != 0) { cout << " "; } else { cout << endl; } } getchar(); getchar(); return 0; } for (j = 1; j <= 30 - i; j++) { //long num2 = j*i + i; long num2 = ( pow(2,j)-1) * num + num; //cout << "num2->" << num2 << endl; //cout << "j->" << j << " i->" << i << endl << endl; if (num2 == k) { cout << j + i << endl; for (int jj = 0; jj < j; jj++) { cout << 0 << " "; } for (int jj = 0; jj < i; jj++) { cout << 1; if (jj + 1 != i) { cout << " "; } else { cout << endl; } } getchar(); getchar(); return 0; } } } getchar(); getchar(); return 0; }