結果

問題 No.800 四平方定理
ユーザー ats5515ats5515
提出日時 2019-03-17 23:08:26
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 588 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 93,356 KB
最終ジャッジ日時 2023-09-22 09:54:10
合計ジャッジ時間 5,206 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
9,800 KB
testcase_01 AC 38 ms
7,300 KB
testcase_02 AC 24 ms
6,028 KB
testcase_03 AC 29 ms
6,568 KB
testcase_04 AC 23 ms
6,000 KB
testcase_05 AC 28 ms
6,380 KB
testcase_06 AC 48 ms
8,100 KB
testcase_07 AC 34 ms
6,828 KB
testcase_08 AC 46 ms
8,308 KB
testcase_09 AC 39 ms
7,328 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
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 <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, D;
	cin >> N >> D;
	map<int, int> mp;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			mp[i * i - j * j + D]++;
		}
	}
	int res = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			res += mp[i * i + j * j];
		}
	}

	cout << res << endl;
}
0