結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-02-06 16:12:42 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 2,000 ms |
| コード長 | 669 bytes |
| 記録 | |
| コンパイル時間 | 2,015 ms |
| コンパイル使用メモリ | 183,788 KB |
| 実行使用メモリ | 67,144 KB |
| 最終ジャッジ日時 | 2026-02-06 16:12:47 |
| 合計ジャッジ時間 | 4,934 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int,int>
#define fs first
#define sc second
#define il inline
#define re register
using namespace std;
il int read()
{
re int x=0;
re int ff=1;
re char c=getchar();
while(c<'0'||c>'9'){
if(c=='-')
ff=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
x=x*10+c-'0';
c=getchar();
}
return x*ff;
}
const int N=1e7+6;
int n,k,cnt[N],awa;
signed main()
{
n=read(),k=read();
for(re int a=1;a<=n;a++)
for(re int b=1;b<=n;b++)
cnt[a*a+b*b]++;
for(re int c=1;c<=n;c++)
for(re int d=1;d<=n;d++)
if(d*d+k-c*c>0)
awa+=cnt[d*d+k-c*c];
printf("%lld\n",awa);
return 0;
}
vjudge1