結果

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

ソースコード

diff #

// code by lynmisakura. wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

#define REP(i,N) for(int i = 0;i < N;i++)
using ll = long long;

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  
  ll N;cin >> N;
  
  int ans = 0;

  for(ll x = 1;x * x < N*N;x++){
    ll y = sqrt(N*N - x*x);
    ans += (x*x + y*y == N*N);
  }

  cout << ans << '\n';

}

0