結果
| 問題 | 
                            No.2479 Sum of Squares
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-09-27 15:16:37 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 468 bytes | 
| コンパイル時間 | 669 ms | 
| コンパイル使用メモリ | 74,388 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-20 09:22:08 | 
| 合計ジャッジ時間 | 6,253 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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{
		do{
			if(sqrt(num * 1.0) == (int)sqrt(num * 1.0)){
				sq.push_back(num);
				S -= num;
				num = S;
			}else{
				num--;
			}
		}while(S > 0);
	}while(sq.size() > 15);
//output
	cout << sq.size() << endl;
	for(int i=0;i<sq.size();i++){
		cout << sq[i];
		if(i != sq.size() - 1){
			cout << " ";
		}
	}
}