結果

問題 No.800 四平方定理
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2019-03-17 21:39:19
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,079 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 87,916 KB
実行使用メモリ 69,168 KB
最終ジャッジ日時 2023-09-22 04:26:47
合計ジャッジ時間 12,579 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
34,940 KB
testcase_01 AC 13 ms
35,308 KB
testcase_02 AC 12 ms
34,884 KB
testcase_03 AC 12 ms
35,012 KB
testcase_04 AC 12 ms
35,060 KB
testcase_05 AC 12 ms
34,916 KB
testcase_06 AC 13 ms
35,380 KB
testcase_07 AC 13 ms
35,636 KB
testcase_08 AC 13 ms
35,460 KB
testcase_09 AC 13 ms
35,304 KB
testcase_10 AC 56 ms
52,168 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 11 ms
34,624 KB
testcase_21 AC 11 ms
34,580 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 11 ms
34,612 KB
testcase_27 AC 11 ms
34,616 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define endl "\n"
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

ll dd[4000100];

int main(){
	clr(dd,0);
	ll n,d;
	cin>>n>>d;
	vector<ll> v;
	rep(i,1,n+1){
		rep(j,1,n+1){
			v.pb(i*i-j*j);
		}
	}
	rep(i,1,n+1){
		rep(j,1,n+1){
			dd[i*i+j*j]++;
		}
	}
	ll ans = 0;
	rep(i,0,v.sz){
		if(v[i]+d>=0){
			ans += dd[v[i]+d];
		}
	}
	cout << ans << endl;
	return 0;	
}
0