結果

問題 No.1593 Perfect Distance
ユーザー s ks k
提出日時 2021-07-10 19:30:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,513 bytes
コンパイル時間 1,914 ms
コンパイル使用メモリ 197,132 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 19:51:01
合計ジャッジ時間 2,837 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Pa = pair<ll,ll>; // vector<Pa> event; event.emplace_back(a,b); // 複数要素(複雑なのを含む)->sortしないならclassを作成すべし
using VPll = vector<pair<ll,ll>>;   //VPll event; event.emplace_back(a,b); 
using Vll = vector<ll>;    // Vll a(6,0); //要素0~5 初期値0  
using VVll = vector<Vll>;  // VVll G(N+1,Vll(0));  VVll a(5,Vll(3,0));  vector<VVll> G(H+1,VVll(W+1,Vll(5,0)));
#define INF (ll)1<<60 // 10^18 < 1<<60 = 1152921504606846976
#define FOR(i,a,b)  for(ll i=(ll)(a); i<(ll)(b); i++)// a ~ b-1 i++ for
#define FOR_(i,b,a)  for(ll i=(ll)(b)-1; (ll)(a)<=i; i--)//  b-1 ~ a i-- for
#define ALL(a) (a).begin(),(a).end() // min,max,sort,find,lower_bound
#define OI(s) cout<<(s)<<"\n"  // printf("%8.8lf\n",(s));//double 小数点上8桁まで,下8桁まで出力
#define OI2(s0,s1) cout<<(s0)<<" "<<(s1)<<"\n"
#define OI3(s0,s1,s2) cout<<(s0)<<" "<<(s1)<<" "<<(s2)<<"\n"
#define OI4(s0,s1,s2,s3) cout<<(s0)<<" "<<(s1)<<" "<<(s2)<<" "<<(s3)<<"\n"
#define OIV(a) for(ll i=0;i<(a).size();i++){if((a)[i]==INF){cout<<"I"<<" ";}else {cout<<(a)[i]<<" ";}} cout<<""<<"\n"
#define OIVV(a) for(ll i=0;i<(a).size();i++){for(ll j=0;j<(a[i]).size();j++){if((a)[i][j]==INF){cout<<"I"<<" ";}else {cout<<(a)[i][j]<<" ";}}cout<<" "<<"\n";}

int main(){
    ll x,y,N;
    cin>>N;
    ll cnt=0;
    FOR(x,1,N ){
        y=sqrt(N*N-x*x);
        if(y*y==N*N-x*x) cnt+=1;
        //OI3(x,y,cnt);
    }
    OI(cnt);

    return 0;
}
0