結果

問題 No.3156 Count That Day's N
ユーザー Guran08
提出日時 2025-05-24 00:23:17
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 3,000 ms
コード長 1,176 bytes
コンパイル時間 5,932 ms
コンパイル使用メモリ 336,088 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-24 00:23:25
合計ジャッジ時間 7,200 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
//using mint = modint1000000007;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
template<typename T>bool chmax(T& a, const T& b) { if (a < b) { a = b;return true; } else { return false; } }
template<typename T>bool chmin(T& a, const T& b) { if (a > b) { a = b;return true; } else { return false; } }

const int di[] = { -1,0,1,0 };
const int dj[] = { 0,-1,0,1 };
const long long INF = 9223372036854775807;
const int inf = 1001001001;

ll pow(int x, int n) {
    ll cnt = 1;
    for (int i = 0; i < n; i++) {
        cnt *= x;
    }
    return cnt;
}

int main(void) {
    ll k, n; cin >> k >> n;
    set<ll> s;
    for (ll x = 1; x * x * x * x * x * x <= n; x++) {
        for (ll y = 1; y * y * y * y <= n; y++) {
            ll sum = x * x * x * x * x * x + y * y * y * y;
            if (sum > n)break;
            if (sum % k != 0)continue;
            long double m = sum / k;
            ll z = sqrt(m);
            if (z * z == m)s.insert(sum);
        }
    }
    cout << s.size() << "\n";

}
//overflow,out_of_range
0