結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
hazohel
|
| 提出日時 | 2019-03-20 14:12:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 547 bytes |
| コンパイル時間 | 418 ms |
| コンパイル使用メモリ | 54,392 KB |
| 実行使用メモリ | 784,844 KB |
| 最終ジャッジ日時 | 2024-09-19 00:06:03 |
| 合計ジャッジ時間 | 23,445 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 3 |
| other | MLE * 30 |
ソースコード
#include <iostream>
using namespace std;
#define INF 100000000
int N, D;
int LEFT[INF];
int RIGHT[INF];
int main(){
cin >> N >> D;
for(int i = 0; i < INF; ++i){
LEFT[i] = 0;
RIGHT[i] = 0;
}
for(int x = 1;x <= N; ++x){
for(int y = 1; y <= N; ++y){
LEFT[x*x+y*y]++;
}
}
for(int z = 1;z <= N; ++z){
for(int w = 1; w <= N; ++w){
if(w*w-z*z +D >0){
RIGHT[w*w - z*z + D]++;
}
}
}
int ans = 0;
for(int i = 0; i < INF; ++i){
ans += LEFT[i] * RIGHT[i];
}
cout << ans << endl;
}
hazohel