結果

問題 No.800 四平方定理
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2019-03-17 21:31:55
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,044 bytes
コンパイル時間 948 ms
コンパイル使用メモリ 95,140 KB
実行使用メモリ 127,116 KB
最終ジャッジ日時 2023-09-22 04:01:50
合計ジャッジ時間 5,184 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
5,452 KB
testcase_01 AC 36 ms
7,472 KB
testcase_02 AC 23 ms
6,256 KB
testcase_03 AC 27 ms
6,792 KB
testcase_04 AC 22 ms
5,944 KB
testcase_05 AC 25 ms
6,524 KB
testcase_06 AC 43 ms
8,636 KB
testcase_07 AC 32 ms
6,896 KB
testcase_08 AC 42 ms
8,904 KB
testcase_09 AC 37 ms
7,416 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
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 <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

int main(){
	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);
		}
	}
	map<ll,ll> ma;
	rep(i,1,n+1){
		rep(j,1,n+1){
			ma[i*i-j*j]++;
		}
	}
	ll ans = 0;
	rep(i,0,v.sz){
		ans += ma[v[i]-d];
	}
	cout << ans << endl;
	return 0;	
}
0