結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
pppppppoipoi
|
| 提出日時 | 2019-04-16 22:56:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 518 bytes |
| コンパイル時間 | 628 ms |
| コンパイル使用メモリ | 69,316 KB |
| 実行使用メモリ | 65,780 KB |
| 最終ジャッジ日時 | 2024-09-22 08:24:32 |
| 合計ジャッジ時間 | 3,019 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 28 RE * 2 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main(void){
int n,d,ans = 0;
cin >> n >> d;
vector<int> a(2*n*n+10),b(2*n*n+10);
for(int x = 1;x <= n;x++){
for(int y = 1;y <= n;y++){
a[x*x+y*y]++;
}
}
for(int w = 1;w <= n;w++){
for(int z = 1;z <= n;z++){
if(w*w-z*z+d < 0) continue;
b[w*w-z*z+d]++;
}
}
for(int i = 0;i <= 2*n*n;i++){
ans += a[i]*b[i];
}
cout << ans << endl;
}
pppppppoipoi