結果

問題 No.1593 Perfect Distance
ユーザー chacoder1
提出日時 2021-07-26 20:08:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 1,698 ms
コンパイル使用メモリ 193,424 KB
最終ジャッジ日時 2025-01-23 09:45:22
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long

signed main(){
  int n;
  cin>>n;
  int cnt=0;
  for(int x=1;x<=n;x++){
    ll y=(ll)(sqrt(1.0*n*n-1.0*x*x));
    if(y==0) continue;
    if(x*x+y*y==n*n) cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}
0