結果

問題 No.1593 Perfect Distance
ユーザー shobonvip
提出日時 2023-11-15 02:24:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 272 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 196,936 KB
最終ジャッジ日時 2025-02-17 22:02:41
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n; cin >> n;
	set<ll> st;
	for (ll x=1; x<=n; x++){
		st.insert(x*x);
	}
	ll ans = 0;
	for (ll y=1; y<=n; y++){
		if (st.find(n*n-y*y) != st.end()){
			ans++;
		}
	}
	cout << ans << '\n';
}
0