結果

問題 No.800 四平方定理
ユーザー asdf1asdf1
提出日時 2019-03-17 21:41:14
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,175 bytes
コンパイル時間 1,488 ms
コンパイル使用メモリ 153,852 KB
実行使用メモリ 158,228 KB
最終ジャッジ日時 2023-09-22 04:35:59
合計ジャッジ時間 5,402 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
9,796 KB
testcase_01 AC 39 ms
7,304 KB
testcase_02 AC 24 ms
5,980 KB
testcase_03 AC 30 ms
6,716 KB
testcase_04 AC 23 ms
5,904 KB
testcase_05 AC 28 ms
6,260 KB
testcase_06 AC 48 ms
8,048 KB
testcase_07 AC 33 ms
6,824 KB
testcase_08 AC 44 ms
8,244 KB
testcase_09 AC 40 ms
7,252 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

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;};
map<ll,ll> mp;

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

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

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