結果

問題 No.1593 Perfect Distance
ユーザー JiKuaiJiKuai
提出日時 2021-07-09 21:43:05
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,486 bytes
コンパイル時間 1,741 ms
使用メモリ 3,576 KB
最終ジャッジ日時 2023-02-01 22:42:34
合計ジャッジ時間 2,916 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,476 KB
testcase_01 AC 1 ms
3,560 KB
testcase_02 AC 1 ms
3,432 KB
testcase_03 AC 1 ms
3,380 KB
testcase_04 AC 1 ms
3,384 KB
testcase_05 AC 1 ms
3,440 KB
testcase_06 AC 1 ms
3,484 KB
testcase_07 AC 1 ms
3,504 KB
testcase_08 AC 2 ms
3,484 KB
testcase_09 AC 1 ms
3,432 KB
testcase_10 AC 1 ms
3,560 KB
testcase_11 AC 1 ms
3,392 KB
testcase_12 AC 2 ms
3,452 KB
testcase_13 AC 2 ms
3,576 KB
testcase_14 AC 1 ms
3,544 KB
testcase_15 AC 2 ms
3,452 KB
testcase_16 AC 2 ms
3,508 KB
testcase_17 AC 2 ms
3,440 KB
testcase_18 AC 2 ms
3,560 KB
testcase_19 AC 1 ms
3,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << "\e[1;31m" << #x << " = " << (x) << "\e[0m\n"
#define print(x) emilia_mata_tenshi(#x, begin(x), end(x))
template<typename T> void emilia_mata_tenshi(const char *s, T l, T r) {
	cerr << "\e[1;33m" << s << " = [";
	while(l != r) {
		cerr << *l;
		cerr << (++l == r ? ']' : ',');
	}
	cerr << "\e[0m\n";
}

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using uint = uint32_t;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*--------------------------------------------------------------------------------------*/

signed main() { EmiliaMyWife
	ll n;
	cin >> n;
	n *= n;
	int ans = 0;
	for(ll i = 1; i * i < n; i++) {
		ll w = n - i * i;
		ll g = sqrt(w);
		if(g * g == w) {
			ans++;
		}
	}
	cout << ans << '\n';
}
0