結果
| 問題 | No.2479 Sum of Squares |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-22 23:35:51 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 587 bytes |
| 記録 | |
| コンパイル時間 | 2,436 ms |
| コンパイル使用メモリ | 248,640 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-08 14:12:05 |
| 合計ジャッジ時間 | 5,618 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 22 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
int main() {
ios_base:: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long S;
cin >> S;
vector<long long> A;
while (S > 0) {
long long low = 0, high = 1000000001;
while (low <= high) {
long long mid = (low + high) >> 1;
if (mid * mid * 1LL <= S) {
low = mid + 1;
} else {
high = mid - 1;
}
}
--low;
A.push_back(low * low);
S -= low * low;
}
int N = A.size();
cout << N << endl;
for (int w : A) {
cout << w << " ";
}
cout << "\n";
}