結果

問題 No.1593 Perfect Distance
コンテスト
ユーザー aogera
提出日時 2025-12-28 14:03:32
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 305 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,005 ms
コンパイル使用メモリ 346,152 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-28 14:03:37
合計ジャッジ時間 4,879 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/extc++.h>
using namespace std;
using ll=long long;
int main(){
	ll N;cin>>N;
	int ans=0;
	auto is_sqr=[&](ll x)->bool{
		ll t=sqrtl(x);
		for(int j=t-10;j<t+10;j++){
			if(j*j==x) return true;
		}
		return false;
	};
	for(int x=1;x<N;x++){
		if(is_sqr(N*N-x*x)) ans++;
	}
	cout<<ans<<endl;
}
0