結果

問題 No.800 四平方定理
ユーザー zunda1stzunda1st
提出日時 2019-03-19 17:55:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 798 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 42,464 KB
最終ジャッジ日時 2023-10-12 02:26:13
合計ジャッジ時間 3,073 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
42,224 KB
testcase_01 AC 11 ms
42,080 KB
testcase_02 AC 12 ms
42,148 KB
testcase_03 AC 12 ms
42,452 KB
testcase_04 AC 12 ms
42,204 KB
testcase_05 AC 12 ms
42,452 KB
testcase_06 AC 12 ms
42,272 KB
testcase_07 AC 11 ms
42,172 KB
testcase_08 AC 12 ms
42,148 KB
testcase_09 AC 11 ms
42,200 KB
testcase_10 AC 23 ms
42,332 KB
testcase_11 AC 25 ms
42,168 KB
testcase_12 AC 27 ms
42,160 KB
testcase_13 AC 23 ms
42,464 KB
testcase_14 AC 24 ms
42,148 KB
testcase_15 AC 25 ms
42,276 KB
testcase_16 AC 23 ms
42,288 KB
testcase_17 AC 24 ms
42,204 KB
testcase_18 AC 27 ms
42,216 KB
testcase_19 AC 26 ms
42,168 KB
testcase_20 AC 12 ms
42,236 KB
testcase_21 AC 11 ms
42,288 KB
testcase_22 AC 26 ms
42,344 KB
testcase_23 AC 43 ms
42,216 KB
testcase_24 AC 55 ms
42,336 KB
testcase_25 AC 70 ms
42,216 KB
testcase_26 AC 13 ms
42,196 KB
testcase_27 AC 13 ms
42,268 KB
testcase_28 AC 52 ms
42,208 KB
testcase_29 AC 54 ms
42,392 KB
testcase_30 AC 55 ms
42,276 KB
testcase_31 AC 50 ms
42,188 KB
testcase_32 AC 57 ms
42,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<tuple>
#include<stdio.h>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Q;
ll longinf=1ll<<60;
int inf=1<<29;
//mleしなければぜんぶllでかく。


int main(){
	int n,d;
	cin>>n>>d;
	vector<int> hoge(10000000,0);
	for(int x=1;x<=n;x++){
		for(int y=1;y<=n;y++){
			hoge[x*x+y*y]++;
		}
	}
	ll ans=0;
	for(int w=1;w<=n;w++){
		for(int z=1;z<=n;z++){
			if(w*w+d-z*z>=1){
				ans+=hoge[w*w+d-z*z];
			}
		}
	}
	cout<<ans<<endl;
    return 0;
}
0