結果

問題 No.800 四平方定理
ユーザー yuma220284yuma220284
提出日時 2020-02-10 09:52:11
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 383 bytes
コンパイル時間 1,742 ms
コンパイル使用メモリ 166,652 KB
実行使用メモリ 72,192 KB
最終ジャッジ日時 2024-04-08 12:48:56
合計ジャッジ時間 5,792 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
13,480 KB
testcase_01 AC 27 ms
6,676 KB
testcase_02 AC 17 ms
6,676 KB
testcase_03 AC 20 ms
6,676 KB
testcase_04 AC 17 ms
6,676 KB
testcase_05 AC 21 ms
6,676 KB
testcase_06 AC 32 ms
6,676 KB
testcase_07 AC 30 ms
6,784 KB
testcase_08 AC 41 ms
8,320 KB
testcase_09 AC 25 ms
6,676 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 "bits/stdc++.h"
using namespace std;

int main() {
	long long N, D;
	cin >> N >> D;
	map<long long, long long> mp;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) mp[i * i + j * j]++;
	}
	long long ANS = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (i * i + D >= j * j) ANS += mp[i * i - j * j + D];
		}
	}
	cout << ANS << endl;
}
0