結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
ats5515
|
| 提出日時 | 2019-03-17 23:14:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 640 bytes |
| コンパイル時間 | 679 ms |
| コンパイル使用メモリ | 86,692 KB |
| 実行使用メモリ | 23,220 KB |
| 最終ジャッジ日時 | 2024-07-08 02:16:53 |
| 合計ジャッジ時間 | 2,108 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
int MOD = 1000000007;
int mp[8001000];
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, D;
cin >> N >> D;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
int t = i * i - j * j + D;
if (t < 0)break;
mp[t]++;
}
}
long long res = 0;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
res += (long long)mp[i * i + j * j];
}
}
cout << res << endl;
}
ats5515