結果
問題 |
No.800 四平方定理
|
ユーザー |
![]() |
提出日時 | 2020-06-13 19:37:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 521 bytes |
コンパイル時間 | 1,130 ms |
コンパイル使用メモリ | 80,736 KB |
最終ジャッジ日時 | 2025-01-11 03:55:09 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | AC * 12 TLE * 18 |
ソースコード
#include <iostream> #include <vector> #include <map> using namespace std; using ll = long long; void ins() {} template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);} #define rep(i,n) for(int i=0,_i=(n);i<_i;++i) int main() { int N, D; ins(N, D); map<int, int> m, m2; rep(i, N) rep(j, N) { ++m[(i+1)*(i+1)+(j+1)*(j+1)]; ++m2[(i+1)*(i+1)-(j+1)*(j+1)]; } ll ans = 0; for (const auto& [wz, count]:m2) { ans += m[wz+D] * count; } cout << ans << endl; return 0; }