結果

問題 No.1593 Perfect Distance
ユーザー shiroha_F14shiroha_F14
提出日時 2021-07-09 21:57:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 390 bytes
コンパイル時間 1,460 ms
コンパイル使用メモリ 163,500 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-14 08:53:54
合計ジャッジ時間 6,778 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define fs(n) fixed << setprecision(n);
#define mp(a, b) make_pair(a, b);
using ll = long long;
using ld = long double;

int main(){
  ll n; cin >> n;
  int ans = 0;
  for(ll i = 1; i < 200000; i++){
    ll j = n * n - i * i;
    for(ll x = 1; x <= sqrt(j); x++){
      if(x * x == j){
        ans++;
      }
    }
  }
  cout << ans << endl;
}
0