結果
| 問題 |
No.2479 Sum of Squares
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2023-09-22 21:23:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 439 ms / 2,000 ms |
| コード長 | 745 bytes |
| コンパイル時間 | 1,999 ms |
| コンパイル使用メモリ | 196,368 KB |
| 最終ジャッジ日時 | 2025-02-17 00:17:55 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#if __has_include("Today's/debug.cpp")
#include "Today's/debug.cpp"
#else
#define debug(...)
#define print_line
#define debugc(...)
#define cerr \
if (false) cerr
#endif
mt19937 mt;
random_device rnd;
void run() {
long long s;
cin >> s;
auto Solve = [&]() {
vector<long long> A;
while (s > 0) {
long long now = 1;
while ((now + 1) * (now + 1) <= s) {
now++;
}
A.push_back(now * now);
s -= now * now;
}
cout << A.size() << endl;
for (int i = 0; i < (int)A.size(); i++) {
cout << A[i] << ' ';
}
cout << endl;
};
Solve();
}
int main() {
mt.seed(rnd());
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--) {
run();
}
}
Today03