結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2023-02-05 05:19:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 184 ms / 2,000 ms |
| コード長 | 496 bytes |
| コンパイル時間 | 443 ms |
| コンパイル使用メモリ | 55,216 KB |
| 実行使用メモリ | 159,684 KB |
| 最終ジャッジ日時 | 2024-07-03 22:35:00 |
| 合計ジャッジ時間 | 6,205 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <string.h>
using namespace std;
long long int cs[10000001],cs2[10000001];
int main() {
memset(cs,0,sizeof(cs));
memset(cs2,0,sizeof(cs2));
int n,d;
cin>>n>>d;
for(int x=1;x<=n;x++){
for(int y=x;y<=n;y++){
int t=x*x+y*y;
cs[t]+=(x==y)?1:2;
t=d+(x-y)*(x+y);
if(0<t)cs2[t]++;
if(x==y)continue;
t=d+(y-x)*(x+y);
if(t>0)cs2[t]++;
}
}
long long int ans=0;
for(int i=1;i<=10000000;i++){
ans+=cs[i]*cs2[i];
}
cout<<ans<<endl;
return 0;
}
horiesiniti