結果

問題 No.800 四平方定理
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2019-06-17 19:11:56
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,683 bytes
コンパイル時間 1,098 ms
コンパイル使用メモリ 79,104 KB
実行使用メモリ 34,308 KB
最終ジャッジ日時 2023-08-18 19:47:51
合計ジャッジ時間 22,137 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,376 KB
testcase_01 AC 18 ms
4,532 KB
testcase_02 AC 13 ms
4,376 KB
testcase_03 AC 13 ms
4,420 KB
testcase_04 AC 13 ms
4,376 KB
testcase_05 AC 14 ms
4,624 KB
testcase_06 AC 21 ms
4,964 KB
testcase_07 AC 17 ms
4,584 KB
testcase_08 AC 16 ms
4,792 KB
testcase_09 AC 19 ms
4,692 KB
testcase_10 AC 1,375 ms
30,660 KB
testcase_11 AC 1,450 ms
34,112 KB
testcase_12 AC 1,611 ms
33,400 KB
testcase_13 AC 1,306 ms
31,864 KB
testcase_14 AC 1,384 ms
33,920 KB
testcase_15 AC 1,664 ms
33,592 KB
testcase_16 AC 1,415 ms
34,156 KB
testcase_17 AC 1,383 ms
34,080 KB
testcase_18 AC 1,729 ms
34,076 KB
testcase_19 AC 1,852 ms
34,308 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1,839 ms
34,112 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#include <tuple>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
#define MOD 1000000007
#define INF 1000000000
#define LLINF 4000000000000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename... R> void input(string& f, R&... r) { cin >> f; input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion

int main() {
    int N, D; input(N, D);
    map<int, int> mp;
    int ans = 0;
    REP(x, N) {
        REP(y, N) {
            int a = (x + 1) * (x + 1) + (y + 1) * (y + 1);
            mp[a]++;
        }
    }
    REP(z, N) {
        REP(w, N) {
            int b = D + (w + 1) * (w + 1) - (z + 1) * (z + 1);
            if (mp.find(b) != mp.end()) ans += mp[b];
        }
    }
    cout << ans << endl;
    getchar(); getchar();
}
0