結果

問題 No.3156 Count That Day's N
ユーザー tatesoto
提出日時 2025-05-04 03:33:47
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,062 bytes
コンパイル時間 3,096 ms
コンパイル使用メモリ 276,168 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-05-23 18:30:31
合計ジャッジ時間 5,041 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 19 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define out(x) cout<<x<<'\n'
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<(ll)(n);i++)
template<class T> inline bool chmin(T& a, T b) {if(a > b){a = b; return true;} else {return false;}};
template<class T> inline bool chmax(T& a, T b) {if(a < b){a = b; return true;} else {return false;}};
const ll INF=(1LL<<60);
const ll mod=998244353;
using Graph = vector<vector<ll>>;
using Network = vector<vector<pair<ll,ll>>>;
using Grid = vector<string>;
const vector<ll> dx = {0, 1, 0, -1};
const vector<ll> dy = {1, 0, -1, 0};

ll solve(ll K, ll N) {
    ll cnt = 0;
    for (ll x = 1; x*x*x*x*x*x <= N; x++) {
        for (ll y = 1; y*y*y*y <= N; y++) {
            ll n = x*x*x*x*x*x + y*y*y*y;
            if(n % K != 0) continue;
            n = n / K;
            ll z = sqrt((ld)n);
            if(z*z != n) continue;
            cnt++;
        }
    }
    return cnt;
}


int main() {
    ll K, N;
    cin >> K >> N;
    cout << solve(K, N) << endl;
}
0