結果

問題 No.1383 Numbers of Product
ユーザー ChanyuhChanyuh
提出日時 2021-02-19 10:09:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,721 bytes
コンパイル時間 1,288 ms
コンパイル使用メモリ 131,680 KB
実行使用メモリ 71,852 KB
最終ジャッジ日時 2023-10-13 21:19:46
合計ジャッジ時間 14,292 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,348 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 OLE -
testcase_08 OLE -
testcase_09 OLE -
testcase_10 OLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<array>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
#include<cassert>
using namespace std;
typedef unsigned long long ll;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}

ll N,M,K;
map<ll,int> ma;

ll Kth_root(ll x,int k){
    if(x==1) return 1;
    if(k>64) return 1;
    ll l=0,r=numeric_limits<ll>::max();
    while(r-l>1){
        ll mid=(l+r)/(ll)2;
        ll d=mid;
        bool larger=false;
        rep(i,k-1){
            if(d>x/mid+(ll)1){
                larger=true;
                break;
            }
            d*=mid;
        }
        if(d>x) larger=true;
        if(larger) r=mid;
        else l=mid;
    }
    return l;
}

void solve(){
    cin >> N >> K >> M;
    Rep(i,2,35){
        ll A=1;
        while(true){
            ll Z=1;
            bool flag=false;
            rep(j,i+1){
                Z*=A+j*K;
                if(Z>N) {
                    flag=true;
                    break;
                }
            }
            if(flag) break;
            ma[Z]++;
            A++;
        }
    }
    ll ans=0;
    if(M==1){
        ll l=0,r=mod;
        while(r-l>1){
            ll mid=(l+r)/2;
            if(mid*(mid+K)>N) r=mid;
            else l=mid;
        }
        cout << l << " " << l*(l+K) << endl;
        ans+=l;
    }
    for(auto p:ma){
        bool f=false;
        ll l=0,r=mod;
        while(r-l>1){
            ll mid=(l+r)/2;
            if(mid*(mid+K)<0) r=mid;
            if(mid*(mid+K)>p.first) r=mid;
            else l=mid;
        }
        cout << p.first << " " << p.second << " " << l << " " << l*(l+K) << endl;
        if(l*(l+K)==p.first) f=true;
        cout << f+p.second << endl;
        if(f+p.second==M) ans++;
        if(M==1 && f) if(p.second>=1) {
            ans--;
        }
    }
    cout << ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}
0