結果

問題 No.800 四平方定理
ユーザー tempura_pptempura_pp
提出日時 2019-03-14 14:39:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 386 bytes
コンパイル時間 631 ms
コンパイル使用メモリ 66,388 KB
実行使用メモリ 11,244 KB
最終ジャッジ日時 2023-09-14 12:10:19
合計ジャッジ時間 4,624 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
8,756 KB
testcase_01 AC 22 ms
4,376 KB
testcase_02 AC 14 ms
4,376 KB
testcase_03 AC 16 ms
4,380 KB
testcase_04 AC 13 ms
4,376 KB
testcase_05 AC 15 ms
4,380 KB
testcase_06 AC 28 ms
4,380 KB
testcase_07 AC 19 ms
4,376 KB
testcase_08 AC 27 ms
4,380 KB
testcase_09 AC 23 ms
4,376 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

const int MAX = 7e6;
bool quad[MAX];
int main(){
	int n;
	cin>>n;
	int d;
	cin>>d;
	rep(i,n)quad[(i+1)*(i+1)+d]=1;
	int ans=0;
	REP(i,1,n+1)REP(j,1,n+1)REP(k,1,n+1){
		if(quad[i*i+j*j+k*k]){
			++ans;
		}
	}
	cout<<ans<<endl;
	return 0;
}
0