結果

問題 No.800 四平方定理
ユーザー olpheolphe
提出日時 2019-03-17 21:25:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 901 bytes
コンパイル時間 917 ms
コンパイル使用メモリ 110,716 KB
実行使用メモリ 81,492 KB
最終ジャッジ日時 2023-09-22 03:26:05
合計ジャッジ時間 3,919 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
80,980 KB
testcase_01 AC 23 ms
81,080 KB
testcase_02 AC 23 ms
80,976 KB
testcase_03 AC 24 ms
81,348 KB
testcase_04 AC 22 ms
80,920 KB
testcase_05 AC 23 ms
81,324 KB
testcase_06 AC 23 ms
81,352 KB
testcase_07 AC 23 ms
81,084 KB
testcase_08 AC 23 ms
81,096 KB
testcase_09 AC 23 ms
81,316 KB
testcase_10 AC 42 ms
81,424 KB
testcase_11 AC 48 ms
80,916 KB
testcase_12 AC 47 ms
81,316 KB
testcase_13 AC 44 ms
80,980 KB
testcase_14 AC 48 ms
81,424 KB
testcase_15 AC 48 ms
81,324 KB
testcase_16 AC 48 ms
81,096 KB
testcase_17 AC 50 ms
81,020 KB
testcase_18 AC 48 ms
81,352 KB
testcase_19 AC 49 ms
81,492 KB
testcase_20 AC 23 ms
81,416 KB
testcase_21 AC 23 ms
81,356 KB
testcase_22 AC 49 ms
81,116 KB
testcase_23 AC 98 ms
80,980 KB
testcase_24 AC 100 ms
81,024 KB
testcase_25 AC 98 ms
80,976 KB
testcase_26 AC 23 ms
81,352 KB
testcase_27 AC 23 ms
81,408 KB
testcase_28 AC 95 ms
80,912 KB
testcase_29 AC 97 ms
80,976 KB
testcase_30 AC 101 ms
81,440 KB
testcase_31 AC 90 ms
81,096 KB
testcase_32 AC 99 ms
80,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N >> K;
	vector<int>m(20000000);
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			m[i*i - j * j+10000000]++;
		}
	}
	long long int ans = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			int box = i * i + j * j - K;
			ans += m[box+10000000];
		}
	}
	cout << ans << endl;
	return 0;
}
0