結果
問題 |
No.689 E869120 and Constructing Array 3
|
ユーザー |
|
提出日時 | 2019-02-15 11:07:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 522 bytes |
コンパイル時間 | 759 ms |
コンパイル使用メモリ | 73,264 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-14 06:33:42 |
合計ジャッジ時間 | 3,025 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 6 |
ソースコード
#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; }