結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2019-03-17 22:04:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 468 bytes |
コンパイル時間 | 1,288 ms |
コンパイル使用メモリ | 167,620 KB |
実行使用メモリ | 34,560 KB |
最終ジャッジ日時 | 2024-07-07 23:06:35 |
合計ジャッジ時間 | 2,830 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 2 RE * 1 |
ソースコード
#include "bits/stdc++.h" using namespace std; void solve() { int N, D, ans = 0; cin >> N >> D; vector<int> mp(N*N*2+1); for (int y = 1; y <= N; y++) { for (int z = 1; z <= N; z++) { mp[y*y+z*z]++; } } for (int x = 1; x <= N; x++) { for (int w = 1; w <= N; w++) { int p = D + w * w - x * x; if (p <= 0) continue; ans += mp[p]; } } cout << ans << endl; } int main(void) { solve(); //cout << "yui(*-v・)yui" << endl; return 0; }