結果

問題 No.800 四平方定理
ユーザー asdf1asdf1
提出日時 2019-03-17 22:16:07
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,205 bytes
コンパイル時間 1,095 ms
コンパイル使用メモリ 145,532 KB
実行使用メモリ 65,840 KB
最終ジャッジ日時 2023-09-22 07:15:15
合計ジャッジ時間 8,024 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,476 KB
testcase_01 AC 3 ms
7,456 KB
testcase_02 AC 2 ms
5,388 KB
testcase_03 AC 2 ms
5,340 KB
testcase_04 AC 2 ms
5,452 KB
testcase_05 AC 2 ms
5,392 KB
testcase_06 AC 3 ms
7,440 KB
testcase_07 AC 2 ms
5,528 KB
testcase_08 AC 3 ms
7,440 KB
testcase_09 AC 3 ms
7,392 KB
testcase_10 AC 34 ms
36,172 KB
testcase_11 RE -
testcase_12 AC 41 ms
40,208 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 41 ms
40,160 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 43 ms
40,280 KB
testcase_19 AC 42 ms
40,156 KB
testcase_20 AC 2 ms
5,388 KB
testcase_21 AC 2 ms
5,340 KB
testcase_22 AC 42 ms
40,284 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 2 ms
5,388 KB
testcase_27 AC 2 ms
5,464 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[4000000*2];

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

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+4000002]++;
        }
    }
    rrep(i,1,n+1){
        rrep(j,1,n+1){
            tmp=i*i+j*j-d;
            ans+=kazoe[tmp+4000002];
        }
    }
    Cout(ans);
    return 0;
}
0