結果

問題 No.1593 Perfect Distance
ユーザー kenta255
提出日時 2021-07-10 00:21:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 3,258 ms
コンパイル使用メモリ 192,080 KB
最終ジャッジ日時 2025-01-22 23:10:55
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <atcoder/modint>
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
typedef long long ll;
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
ll keta_(ll a){ll r=0;while(a){a/=10;r++;}return r;}



int main(){

	ll N;
	cin >> N;

	ll ans = 0;
	FOR(i,1,N+1){
		ll jj = N*N - i*i;
		if(jj <= 0) continue;
		ll j = sqrt(jj);
		if(j*j == jj) ans++;
	}
	cout << ans << endl;
}

0