結果
問題 | No.2479 Sum of Squares |
ユーザー |
![]() |
提出日時 | 2023-09-22 21:23:37 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 583 bytes |
コンパイル時間 | 3,872 ms |
コンパイル使用メモリ | 265,084 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-08 12:04:03 |
合計ジャッジ時間 | 17,145 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 TLE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; using namespace chrono; #if __has_include(<atcoder/all>) #include <atcoder/all> using namespace atcoder; #endif int main() { int64_t s; cin >> s; vector<int64_t> as; int64_t x = 1; while ((x + 1) * (x + 1) <= s) { x++; } while (0 < s) { while (x * x <= s) { as.push_back(x * x); s -= x * x; } x--; } cout << as.size() << endl; for (auto &&a : as) { cout << a << ' '; } cout << endl; return 0; }