結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
ats5515
|
| 提出日時 | 2019-03-17 23:08:26 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 588 bytes |
| 記録 | |
| コンパイル時間 | 708 ms |
| コンパイル使用メモリ | 111,476 KB |
| 実行使用メモリ | 149,248 KB |
| 最終ジャッジ日時 | 2026-03-29 18:03:12 |
| 合計ジャッジ時間 | 28,067 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 10 TLE * 11 -- * 9 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, D;
cin >> N >> D;
map<int, int> mp;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
mp[i * i - j * j + D]++;
}
}
int res = 0;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
res += mp[i * i + j * j];
}
}
cout << res << endl;
}
ats5515