結果
問題 |
No.800 四平方定理
|
ユーザー |
|
提出日時 | 2019-03-17 21:26:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 417 bytes |
コンパイル時間 | 1,851 ms |
コンパイル使用メモリ | 201,136 KB |
最終ジャッジ日時 | 2025-01-06 22:42:38 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | AC * 12 TLE * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N, D; cin >> N >> D; map<int, int> mp1, mp2; for(int i=1; i<=N; i++) for(int j=1; j<=N; j++){ mp1[i*i+j*j]++; mp2[i*i-j*j]++; } int64_t ans = 0; for(auto& p : mp2){ int X = p.first; int Y = D-X; if(mp1.count(Y)) ans += p.second * mp1[Y]; } cout << ans << endl; return 0; }