結果
| 問題 |
No.2479 Sum of Squares
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-22 21:21:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 392 bytes |
| コンパイル時間 | 733 ms |
| コンパイル使用メモリ | 74,260 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-08 11:59:46 |
| 合計ジャッジ時間 | 1,927 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 2 |
ソースコード
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
using namespace std;
long sq(long N)
{
long r=sqrt(N);
while((r+1)*(r+1)<=N)r++;
return r;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
long S;
cin>>S;
vector<long>A;
while(S>0)
{
long t=sq(S);
A.push_back(t*t);
S-=t*t;
}
cout<<A.size()<<endl;
for(long v:A)cout<<v<<" ";
cout<<endl;
}