結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2019-03-19 17:55:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 798 bytes |
コンパイル時間 | 700 ms |
コンパイル使用メモリ | 82,776 KB |
実行使用メモリ | 42,424 KB |
最終ジャッジ日時 | 2024-09-14 02:13:25 |
合計ジャッジ時間 | 2,672 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include<map>#include<iostream>#include<deque>#include<algorithm>#include<string>#include<cctype>#include<iomanip>#include<vector>#include<queue>#include<tuple>#include<stdio.h>using namespace std;#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)#define rep0(i,n) REP(i,0ll,n)#define rep1(i,n) REP(i,1ll,n+1)#define shosu setprecision(10)typedef long long ll;typedef pair<ll,ll> P;typedef pair<P,ll> Q;ll longinf=1ll<<60;int inf=1<<29;//mleしなければぜんぶllでかく。int main(){int n,d;cin>>n>>d;vector<int> hoge(10000000,0);for(int x=1;x<=n;x++){for(int y=1;y<=n;y++){hoge[x*x+y*y]++;}}ll ans=0;for(int w=1;w<=n;w++){for(int z=1;z<=n;z++){if(w*w+d-z*z>=1){ans+=hoge[w*w+d-z*z];}}}cout<<ans<<endl;return 0;}