結果

問題 No.800 四平方定理
ユーザー CuriousFairy315CuriousFairy315
提出日時 2019-03-17 21:46:23
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 681 bytes
コンパイル時間 425 ms
使用メモリ 34,780 KB
最終ジャッジ日時 2023-02-11 05:42:49
合計ジャッジ時間 2,445 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
5,524 KB
testcase_01 AC 2 ms
6,948 KB
testcase_02 AC 2 ms
6,948 KB
testcase_03 AC 2 ms
5,468 KB
testcase_04 AC 1 ms
5,416 KB
testcase_05 AC 2 ms
6,948 KB
testcase_06 AC 2 ms
5,424 KB
testcase_07 AC 2 ms
5,520 KB
testcase_08 AC 2 ms
5,572 KB
testcase_09 AC 2 ms
5,480 KB
testcase_10 AC 17 ms
18,908 KB
testcase_11 AC 19 ms
20,832 KB
testcase_12 AC 21 ms
20,508 KB
testcase_13 AC 19 ms
19,672 KB
testcase_14 AC 18 ms
20,912 KB
testcase_15 AC 19 ms
20,748 KB
testcase_16 AC 19 ms
21,000 KB
testcase_17 AC 21 ms
21,052 KB
testcase_18 AC 19 ms
21,036 KB
testcase_19 AC 20 ms
20,972 KB
testcase_20 AC 2 ms
6,948 KB
testcase_21 AC 2 ms
5,544 KB
testcase_22 AC 19 ms
21,016 KB
testcase_23 AC 45 ms
34,772 KB
testcase_24 AC 48 ms
34,780 KB
testcase_25 AC 47 ms
34,596 KB
testcase_26 AC 1 ms
6,952 KB
testcase_27 AC 2 ms
5,492 KB
testcase_28 AC 47 ms
34,628 KB
testcase_29 AC 42 ms
34,560 KB
testcase_30 AC 40 ms
34,620 KB
testcase_31 AC 35 ms
32,444 KB
testcase_32 AC 46 ms
34,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std; // 575

int main() {
	int N, D;
	cin >> N >> D;
	++ N;
	int ans = 0;
	static int tempura_killer[16000000];
	for (int z = 1;z < N;++ z) for (int w = 1;w < N;++ w) ++ tempura_killer[8000000 - (w + z) * (w - z)];
	for (int x = 1;x < N;++ x) for (int y = 1;y < N;++ y) ans += tempura_killer[x * x + y * y - D + 8000000];
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

2個ずつに分けて計算
*/
0