結果

問題 No.800 四平方定理
ユーザー polyomino_24
提出日時 2019-03-18 15:26:03
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 1,381 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 95,532 KB
実行使用メモリ 34,880 KB
最終ジャッジ日時 2024-07-18 10:02:05
合計ジャッジ時間 2,192 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ",debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a){
os << '(' << a.first << ',' << a.second << ')';
return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
for(auto x:v)os << x << ' ';
return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
cerr << a;
if(sizeof...(b))cerr << ", ";
debug(b...);
}
int mp[100000000];
int main(){
ll n,d;
cin >> n >> d;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
mp[i*i-j*j+4000000]++;
}
}
ll ans = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
ans += mp[i*i+j*j-d+4000000];
}
}
cout << ans << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0