結果

問題 No.800 四平方定理
ユーザー olpheolphe
提出日時 2019-03-17 21:24:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 899 bytes
コンパイル時間 1,017 ms
コンパイル使用メモリ 110,036 KB
実行使用メモリ 43,080 KB
最終ジャッジ日時 2023-09-22 03:23:27
合計ジャッジ時間 7,256 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
42,080 KB
testcase_01 AC 13 ms
42,128 KB
testcase_02 AC 13 ms
42,260 KB
testcase_03 AC 14 ms
42,136 KB
testcase_04 AC 13 ms
42,252 KB
testcase_05 AC 13 ms
42,216 KB
testcase_06 AC 13 ms
42,132 KB
testcase_07 AC 14 ms
42,072 KB
testcase_08 AC 14 ms
42,068 KB
testcase_09 AC 13 ms
42,128 KB
testcase_10 AC 35 ms
42,248 KB
testcase_11 AC 44 ms
42,200 KB
testcase_12 AC 42 ms
42,044 KB
testcase_13 AC 40 ms
42,052 KB
testcase_14 AC 45 ms
42,196 KB
testcase_15 AC 45 ms
42,264 KB
testcase_16 AC 53 ms
42,292 KB
testcase_17 AC 44 ms
42,240 KB
testcase_18 AC 43 ms
42,068 KB
testcase_19 AC 48 ms
42,264 KB
testcase_20 AC 12 ms
42,216 KB
testcase_21 AC 13 ms
42,244 KB
testcase_22 AC 45 ms
42,296 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 14 ms
42,372 KB
testcase_27 AC 13 ms
42,216 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

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(10000000);
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			m[i*i - j * j+5000000]++;
		}
	}
	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+5000000];
		}
	}
	cout << ans << endl;
	return 0;
}
0