結果
問題 | No.689 E869120 and Constructing Array 3 |
ユーザー |
|
提出日時 | 2021-03-04 19:59:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 1,000 ms |
コード長 | 914 bytes |
コンパイル時間 | 816 ms |
コンパイル使用メモリ | 96,388 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-05 07:54:45 |
合計ジャッジ時間 | 2,134 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <iomanip> #include <cmath> #include <stdio.h> #include <queue> #include <deque> #include <cstdio> #include <set> #include <map> #include <bitset> #include <stack> #include <cctype> using namespace std; tuple<int, int, int> t[10010]; int main() { for (int i = 0; i <= 250; i++) { for (int j = 0; j <= 250; j++) { for (int k = 0; k <= 250; k++) { if (i + j + k <= 250) { if (i * j + i * k + max(0, k * (k - 1) / 2) <= 10000) { t[i * j + i * k + max(0, k * (k - 1) / 2)] = make_tuple(i, j, k); } } } } } int k; cin >> k; cout << get<0>(t[k]) + get<1>(t[k]) + get<2>(t[k]) << endl; for (int i = 0; i < get<0>(t[k]); i++) { cout << 2 << " "; } for (int i = 0; i < get<1>(t[k]); i++) { cout << 3 << " "; } for (int i = 0; i < get<2>(t[k]); i++) { cout << 1 << " "; } cout << endl; }