結果

問題 No.1593 Perfect Distance
ユーザー umezoumezo
提出日時 2021-07-09 22:24:18
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 2,053 ms
コンパイル使用メモリ 200,652 KB
実行使用メモリ 5,384 KB
最終ジャッジ日時 2023-09-14 09:38:55
合計ジャッジ時間 3,144 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
5,384 KB
testcase_01 AC 7 ms
5,092 KB
testcase_02 AC 7 ms
5,272 KB
testcase_03 AC 7 ms
5,128 KB
testcase_04 AC 7 ms
5,176 KB
testcase_05 AC 7 ms
5,088 KB
testcase_06 AC 7 ms
5,072 KB
testcase_07 AC 7 ms
5,240 KB
testcase_08 AC 7 ms
5,224 KB
testcase_09 AC 8 ms
5,216 KB
testcase_10 AC 8 ms
5,076 KB
testcase_11 AC 9 ms
5,196 KB
testcase_12 AC 10 ms
5,196 KB
testcase_13 AC 11 ms
5,188 KB
testcase_14 AC 12 ms
5,192 KB
testcase_15 AC 14 ms
5,072 KB
testcase_16 AC 18 ms
5,092 KB
testcase_17 AC 7 ms
5,196 KB
testcase_18 AC 6 ms
5,264 KB
testcase_19 AC 7 ms
5,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n;
  cin>>n;
  
  vector<ll> A;
  for(ll i=1;i<=200000;i++){
    A.push_back(i*i);
  }
  
  ll cnt=0;
  for(auto t:A){
    if(n*n==*lower_bound(ALL(A),n*n-t)+t) cnt++;
  }
  cout<<cnt<<endl;
  
  return 0;
}
0