結果
問題 |
No.800 四平方定理
|
ユーザー |
|
提出日時 | 2021-02-21 22:16:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 1,791 ms |
コンパイル使用メモリ | 198,864 KB |
最終ジャッジ日時 | 2025-01-19 03:15:46 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | AC * 12 TLE * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; // x^2 + y^2과 w^2 - z^2를 구한다. map <int,int> cnt1,cnt2; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n,D; int res = 0; cin >> n >> D; for(int a=1;a<=n;a++) { for(int b=1;b<=n;b++) { cnt1[a*a + b*b]++; cnt2[b*b - a*a]++; } } for(auto it : cnt2) { long long int way = it.second; long long int val = it.first + D; res += (cnt1[val]*way); } cout << res << '\n'; return 0; }