結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2020-03-30 22:29:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 533 bytes |
コンパイル時間 | 2,144 ms |
コンパイル使用メモリ | 193,980 KB |
最終ジャッジ日時 | 2025-01-09 11:08:05 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h>using lint=long long;using real=long double;int main(){std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);std::cout.setf(std::ios_base::fixed);std::cout.precision(15);lint n,d;std::cin>>n>>d;lint N=2*n*n;std::vector<lint>a(N+1);for(lint i=1;i<=n;i++)for(lint j=1;j<=n;j++){a.at(i*i+j*j)++;}lint ans=0;for(lint i=1;i<=n;i++)for(lint j=1;j<=n;j++){lint x=d+i*i-j*j;if(0<=x&&x<=N)ans+=a.at(x);}std::cout<<ans<<'\n';}