結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
monnu
|
| 提出日時 | 2020-09-29 22:16:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 416 bytes |
| コンパイル時間 | 1,719 ms |
| コンパイル使用メモリ | 172,588 KB |
| 実行使用メモリ | 84,000 KB |
| 最終ジャッジ日時 | 2024-07-04 14:23:22 |
| 合計ジャッジ時間 | 8,516 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 10 TLE * 2 -- * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000000000000
#define MOD 1000000007
using ll=long long;
using Graph=vector<vector<int>>;
int main(){
int N,D;
cin>>N>>D;
map<int,int> m;
for(int i=1;i<=N;i++){
for(int j=1;j<=N;j++){
m[i*i+j*j]++;
}
}
int ans=0;
for(int i=1;i<=N;i++){
for(int j=1;j<=N;j++){
ans+=m[i*i-j*j+D];
}
}
cout<<ans<<endl;
}
monnu