結果

問題 No.800 四平方定理
ユーザー kotamanegikotamanegi
提出日時 2019-03-17 21:43:11
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,444 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 110,700 KB
実行使用メモリ 36,588 KB
最終ジャッジ日時 2023-08-20 12:03:49
合計ジャッジ時間 2,755 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,384 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 22 ms
20,872 KB
testcase_15 WA -
testcase_16 AC 21 ms
22,144 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 57 ms
36,224 KB
testcase_25 WA -
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 55 ms
35,020 KB
testcase_29 WA -
testcase_30 AC 56 ms
34,644 KB
testcase_31 AC 50 ms
33,992 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
#include <unordered_map>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*2
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128(void)
{
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t;
	t = (x ^ (x << 11)); x = y; y = z; z = w; return(w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
#include <unordered_map>
int cnt[100000000] = {};
int main() {
	int n, d;
	cin >> n >> d;
	for (int i = 1; i <= n; ++i) {
		for (int q = 1; q <= n; ++q) {
			cnt[i*i+q*q]++;
		}
	}
	long long ans = 0;
	for (int i = 1; i <= n; ++i) {
		for (int q = 1; q <= n; ++q) {
			if (d + i * i - q * q > n*n||d + i*i - q*q < 0) continue;
			ans += cnt[d + i * i - q * q];
		}
	}
	cout << ans << endl;
	return 0;
}
0