結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
a
|
| 提出日時 | 2019-03-17 22:01:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 461 bytes |
| コンパイル時間 | 2,526 ms |
| コンパイル使用メモリ | 174,424 KB |
| 実行使用メモリ | 106,112 KB |
| 最終ジャッジ日時 | 2024-07-07 22:49:26 |
| 合計ジャッジ時間 | 22,586 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 TLE * 1 -- * 9 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
void solve()
{
int N, D, ans = 0;
cin >> N >> D;
map<int, int> mp;
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;
}
a