結果
| 問題 |
No.2479 Sum of Squares
|
| コンテスト | |
| ユーザー |
ineedyourlovep
|
| 提出日時 | 2023-09-22 21:29:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 619 bytes |
| コンパイル時間 | 1,924 ms |
| コンパイル使用メモリ | 194,432 KB |
| 最終ジャッジ日時 | 2025-02-17 00:23:16 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 1000000007;
//const int mod = 998244353;
int main()
{
ll s;
cin >> s;
vector<ll> ans;
while (s) {
ll lb = 1, ub = INF;
while (ub - lb > 1) {
ll mid = (lb + ub)>>1;
if (mid*mid > s) ub = mid;
else lb = mid;
}
ans.push_back(lb*lb);
s -= lb*lb;
}
cout << ans.size() << endl;
for (auto i : ans) cout << i << " ";
cout << endl;
return 0;
}
ineedyourlovep