結果

問題 No.1593 Perfect Distance
ユーザー matcharate12matcharate12
提出日時 2022-03-17 17:48:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 1,503 ms
コンパイル使用メモリ 163,312 KB
実行使用メモリ 6,952 KB
最終ジャッジ日時 2024-04-09 02:53:53
合計ジャッジ時間 2,559 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,948 KB
testcase_02 AC 1 ms
6,948 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,948 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,948 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
6,948 KB
testcase_18 AC 2 ms
6,948 KB
testcase_19 AC 2 ms
6,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <string.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define srep(i,a,b) for(int i = a; i < b; i++)
#define all(A) (A).begin(),A.end()
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void){
	ll n; cin >> n;
	ll cnt = 0;
	rep(x,n){
		ll y = (ll)sqrt(1.0*n*n-1.0*(x+1)*(x+1));
		if(y*y+(x+1)*(x+1) == n*n) cnt++;
	}
	cout << cnt-1;
}
0