結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
hazohel
|
| 提出日時 | 2019-03-20 14:16:49 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 545 bytes |
| コンパイル時間 | 535 ms |
| コンパイル使用メモリ | 119,680 KB |
| 実行使用メモリ | 42,568 KB |
| 最終ジャッジ日時 | 2024-11-30 13:43:50 |
| 合計ジャッジ時間 | 2,480 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 8 |
ソースコード
#include <iostream>
using namespace std;
#define INF 5000000
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