結果

問題 No.689 E869120 and Constructing Array 3
ユーザー face4face4
提出日時 2019-02-15 11:07:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 522 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 73,592 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 07:20:45
合計ジャッジ時間 3,218 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

int main(){
    int k;
    cin >> k;

    // 多分ここで平方根ではなくk-a*bが最小となるようなa,bを見つけるべき
    int a = sqrt(k);
    int n = a + a + k-(a*a) + 1;
    vector<int> ans(n);
    for(int i = 0; i < a; i++)  ans[i] = 2, ans[a+i] = 3;
    ans[2*a] = 7;
    for(int i = 2*a+1; i < n; i++)  ans[i] = 12;

    cout << n << endl;
    for(int i = 0; i < n; i++)  cout << ans[i] << " \n"[i == n-1];

    return 0;
}
0