結果

問題 No.1593 Perfect Distance
ユーザー matcharate12
提出日時 2022-03-17 17:48:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 1,753 ms
コンパイル使用メモリ 165,884 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-01 14:43:08
合計ジャッジ時間 2,464 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 5
権限があれば一括ダウンロードができます

ソースコード

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