結果

問題 No.1593 Perfect Distance
ユーザー shirokamishirokami
提出日時 2021-07-10 13:05:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 1,096 bytes
コンパイル時間 6,813 ms
コンパイル使用メモリ 465,232 KB
実行使用メモリ 28,376 KB
最終ジャッジ日時 2023-09-14 18:52:40
合計ジャッジ時間 9,000 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
15,920 KB
testcase_01 AC 64 ms
16,032 KB
testcase_02 AC 63 ms
15,956 KB
testcase_03 AC 64 ms
15,960 KB
testcase_04 AC 64 ms
16,028 KB
testcase_05 AC 64 ms
15,964 KB
testcase_06 AC 64 ms
15,996 KB
testcase_07 AC 64 ms
15,952 KB
testcase_08 AC 65 ms
16,056 KB
testcase_09 AC 67 ms
16,396 KB
testcase_10 AC 72 ms
17,820 KB
testcase_11 AC 77 ms
18,916 KB
testcase_12 AC 85 ms
20,524 KB
testcase_13 AC 87 ms
20,992 KB
testcase_14 AC 91 ms
21,728 KB
testcase_15 AC 103 ms
24,592 KB
testcase_16 AC 125 ms
28,376 KB
testcase_17 AC 64 ms
16,168 KB
testcase_18 AC 64 ms
15,836 KB
testcase_19 AC 64 ms
15,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#include <atcoder/all>
using namespace atcoder;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
const ll mod = 1e9+7;
const ll INF = 1e18;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using Graph = vector<vector<ll>>;
using V = vector<ll>;
using P = pair<ll,ll>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << setprecision(15) << fixed;
  }
} iosetup;

int main() {
  ll n;
  cin >> n;
  n *= n;
  map<ll,bool> mp;
  Rep(i,1,200010) {
    mp[i*i] = true;
  }
  ll ans = 0;
  Rep(i, 1, 200010) {
    ll x = i*i;
    ll t = n-x;
    if (t < 0) break;
    if (mp[t]) ++ans;
  }
  cout << ans << '\n';
}
0