結果

問題 No.800 四平方定理
コンテスト
ユーザー vjudge1
提出日時 2026-02-05 18:33:01
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
RE  
実行時間 -
コード長 502 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,170 ms
コンパイル使用メモリ 333,096 KB
実行使用メモリ 38,388 KB
最終ジャッジ日時 2026-02-05 18:33:11
合計ジャッジ時間 7,390 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 RE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using db=double;
const int N=1e6+5;
int n,k,f[12*N],ans;
inline void solve(){
	cin>>n>>k;
	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=n;j++){
			f[i*i-j*j+5*N]++;	
		}
	}
	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=n;j++){
			ans+=f[i*i+j*j-k+5*N];
		}
	}
	cout<<ans;
}
signed main(){
//	freopen("alive.in","r",stdin);
//	freopen("alive.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	ll T=1;
//	cin>>T;
	while(T--) solve();
} 
0