結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
pockyny
|
| 提出日時 | 2019-03-18 03:42:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 319 bytes |
| コンパイル時間 | 449 ms |
| コンパイル使用メモリ | 64,424 KB |
| 実行使用メモリ | 42,264 KB |
| 最終ジャッジ日時 | 2024-07-08 10:07:34 |
| 合計ジャッジ時間 | 3,792 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 RE * 8 |
ソースコード
#include <iostream>
using namespace std;
long long cnt[5000010] = {},n,d,ans = 0;
int main(){
int i,j;
cin >> n >> d;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
cnt[i*i+j*j]++;
}
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
if(d - i*i + j*j<=0) continue;
ans += cnt[d-i*i+j*j];
}
}
cout << ans << endl;
}
pockyny