結果
問題 | No.2479 Sum of Squares |
ユーザー |
![]() |
提出日時 | 2023-09-22 21:29:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 466 ms / 2,000 ms |
コード長 | 662 bytes |
コンパイル時間 | 4,124 ms |
コンパイル使用メモリ | 251,924 KB |
最終ジャッジ日時 | 2025-02-17 00:23:09 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#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 = 1; while ((x + 1) * (x + 1) <= s) { x++; } } cout << as.size() << endl; for (auto &&a : as) { cout << a << ' '; } cout << endl; return 0; }