結果

問題 No.2479 Sum of Squares
ユーザー nekoti
提出日時 2023-09-22 21:50:10
言語 C
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 507 bytes
コンパイル時間 1,450 ms
コンパイル使用メモリ 30,208 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-07-08 12:34:44
合計ジャッジ時間 3,941 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _DEBUG 0
#if _DEBUG
#endif

#include<stdio.h>
#include<math.h>
int main(void)
{
  int scan;//scanf警告用
  unsigned long long ans=0;
  long long i, j;
  
  unsigned long long s;scan=scanf("%llu",&s);
  unsigned long long t=s;
  unsigned long long n;
  int count=0;
  while(1)
  {
  	n=sqrt(s);
  	s-=n*n;count++;
  	if(s<4)break;
  }
  printf("%d\n",count+s);
  while(1)
  {
  	n=sqrt(t);
  	t-=n*n;
  	printf("%llu ",n*n);
  	if(t<4)break;
  }
  while(t--)
  {
  	printf("1 ");
  }
  return 0;
}
0