結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2019-03-17 23:08:26 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 588 bytes |
コンパイル時間 | 623 ms |
コンパイル使用メモリ | 87,804 KB |
実行使用メモリ | 96,128 KB |
最終ジャッジ日時 | 2024-07-08 01:57:30 |
合計ジャッジ時間 | 4,632 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | AC * 11 TLE * 10 -- * 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; }