結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-17 22:00:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 471 bytes |
| コンパイル時間 | 579 ms |
| コンパイル使用メモリ | 73,080 KB |
| 実行使用メモリ | 65,860 KB |
| 最終ジャッジ日時 | 2024-07-07 22:47:01 |
| 合計ジャッジ時間 | 3,071 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 4 |
ソースコード
#include<iostream>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
vector<int> l(8000010, 0), r(8000010, 0);
int main(){
int n;
ll d;
cin >> n >> d;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
l[i*i+j*j]++;
r[4000000+i*i-j*j]++;
}
}
ll ans = 0;
for(int i = 0; i < 4000001; i++){
ans += l[i]*r[i-d+4000000];
}
cout << ans << endl;
return 0;
}