結果

問題 No.800 四平方定理
ユーザー asdf1asdf1
提出日時 2019-03-17 22:18:52
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,230 bytes
コンパイル時間 1,156 ms
コンパイル使用メモリ 145,204 KB
実行使用メモリ 68,716 KB
最終ジャッジ日時 2023-09-22 07:24:27
合計ジャッジ時間 7,063 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,580 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 3 ms
4,736 KB
testcase_07 AC 3 ms
4,552 KB
testcase_08 AC 3 ms
5,392 KB
testcase_09 AC 3 ms
4,572 KB
testcase_10 AC 44 ms
36,180 KB
testcase_11 AC 47 ms
38,516 KB
testcase_12 AC 50 ms
38,228 KB
testcase_13 AC 41 ms
36,112 KB
testcase_14 AC 51 ms
38,144 KB
testcase_15 AC 49 ms
40,224 KB
testcase_16 AC 51 ms
40,276 KB
testcase_17 AC 48 ms
40,320 KB
testcase_18 AC 49 ms
40,224 KB
testcase_19 AC 50 ms
40,484 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 52 ms
40,220 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
5,388 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll kazoe[2000*2000+2000*2000+2000+1000000];

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);

    cin>>n>>d;
    rrep(i,1,n+1){  
        rrep(j,1,n+1){
            kazoe[i*i-j*j+n*n+10+d]++;
        }
    }
    rrep(i,1,n+1){
        rrep(j,1,n+1){
            tmp=i*i+j*j-d;
            ans+=kazoe[tmp+n*n+10+d];
        }
    }
    Cout(ans);
    return 0;
}
0