結果

問題 No.3156 Count That Day's N
ユーザー Salt
提出日時 2025-05-23 20:33:58
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,190 bytes
コンパイル時間 3,606 ms
コンパイル使用メモリ 281,880 KB
実行使用メモリ 82,780 KB
最終ジャッジ日時 2025-05-23 20:34:53
合計ジャッジ時間 7,802 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 TLE * 1
other AC * 31 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
//https://boostjp.github.io/tips/multiprec-int.html

#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define YN {cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}// if(a==b)YN;
#define NO2 cout<<-1<<endl

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i=int(n)-1; i>=0; --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

int main() {
    ll K, N;
    cin >> K >> N;

    vector<ll> X, Y;
    ll n = 1;
    ll x = 1;
    while (x <= N) {
        X.emplace_back(x);
        n++;
        x = n*n*n*n*n*n;
    }
    n = 1;
    ll y = 1;
    while (y <= N) {
        Y.emplace_back(y);
        n++;
        y = n*n*n*n;
    }

    //cerr << X.size() << ' ' << Y.size() << endl;

    unordered_set<ll> st;
    for (ll x:X) {
        for (ll y:Y) {
            st.insert(x+y);
        }
    }
    ll num = K;
    ll d = 1;
    ll ans = 0;
    while (num <= N) {
        //cerr << d << endl;
        if (st.find(num) != st.end()) ans++;
        d++;
        num = K*d*d;
    }

    cout << ans << endl;
    return 0;
}
0