結果

問題 No.800 四平方定理
ユーザー ats5515ats5515
提出日時 2019-03-17 23:13:20
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 640 bytes
コンパイル時間 1,368 ms
コンパイル使用メモリ 84,412 KB
実行使用メモリ 23,000 KB
最終ジャッジ日時 2023-09-22 10:08:40
合計ジャッジ時間 4,433 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 16 ms
13,620 KB
testcase_11 AC 17 ms
13,624 KB
testcase_12 AC 18 ms
15,660 KB
testcase_13 AC 14 ms
11,636 KB
testcase_14 AC 15 ms
13,612 KB
testcase_15 AC 17 ms
15,664 KB
testcase_16 AC 15 ms
13,596 KB
testcase_17 AC 16 ms
13,656 KB
testcase_18 AC 21 ms
17,716 KB
testcase_19 AC 21 ms
17,700 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 21 ms
17,708 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
5,528 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
int MOD = 1000000007;
int mp[5001000];
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, D;
	cin >> N >> D;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			int t = i * i - j * j + D;
			if (t < 0)break;
			mp[t]++;
		}
	}
	long long res = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			res += (long long)mp[i * i + j * j];
		}
	}

	cout << res << endl;
}
0