結果

問題 No.689 E869120 and Constructing Array 3
ユーザー e869120e869120
提出日時 2018-05-04 22:02:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 600 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 66,760 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 22:40:26
合計ジャッジ時間 4,108 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 2 ms
4,380 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 2 ms
4,380 KB
testcase_11 RE -
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <tuple>
using namespace std;

int N, A[1009], K;

int main() {
	cin >> K; int minx = 10000;
	for (int i = 0; i <= 0; i++) {
		for (int j = 0; j <= 140; j++) {
			for (int k = 0; k <= 140; k++) {
				if (j*k + i*(i - 1) / 2 != K) continue;

				if (minx > i + j + k) {
					minx = i + j + k;
					for (int l = 0; l < i; l++) A[l] = 1;
					for (int l = i; l < i + j; l++) A[l] = 3;
					for (int l = i + j; l < i + j + k; l++) A[l] = 8;
				}
			}
		}
	}
	cout << minx << endl;
	for (int i = 0; i < minx; i++) { if (i)cout << " "; cout << A[i]; }cout << endl;
	return 0;
}
0