結果
| 問題 |
No.2479 Sum of Squares
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-27 15:13:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 429 bytes |
| コンパイル時間 | 709 ms |
| コンパイル使用メモリ | 74,672 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-20 09:18:02 |
| 合計ジャッジ時間 | 5,757 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 22 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(void){
//input
int S; cin >> S;
//calc
int num = S; vector<int> sq;
do{
if(sqrt(num * 1.0) == (int)sqrt(num * 1.0)){
sq.push_back(num);
S -= num;
num = S;
}else{
num--;
}
}while(S > 0);
//output
cout << sq.size() << endl;
for(int i=0;i<sq.size();i++){
cout << sq[i];
if(i != sq.size() - 1){
cout << " ";
}
}
}