結果
問題 |
No.800 四平方定理
|
ユーザー |
|
提出日時 | 2019-03-18 00:38:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 556 bytes |
コンパイル時間 | 1,263 ms |
コンパイル使用メモリ | 159,600 KB |
実行使用メモリ | 65,664 KB |
最終ジャッジ日時 | 2024-07-08 07:48:40 |
合計ジャッジ時間 | 4,235 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 2 RE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int N, D; cin >> N >> D; vector<int64_t> arr(N * N + N * N, 0); for (int x = 1; x <= N; x++) { for (int y = 1; y <= N; y++) { arr[x * x + y * y]++; } } int64_t ans = 0; for (int w = 1; w <= N; w++) { for (int z = 1; z <= N; z++) { int one = w * w - z * z + D; if (one >= 0) { ans += arr[one]; } } } cout << ans << endl; return 0; }