QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#882618 | #8336. Indeterminate Equation | ucup-team5077# | WA | 107ms | 19256kb | C++14 | 674b | 2025-02-05 09:56:43 | 2025-02-05 09:56:54 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define int128 __int128
const int N=2e6+5,B=2e6;
int T,n_,k_;
int128 n,k;
int128 pw(int x,int k){
int128 tot=1;
for(int i=1;i<=k;i++) tot*=x;
return tot;
}
int p[N],id;
signed main(){
cin>>T;
while(T--){
cin>>n_>>k_;
n=n_,k=k_;
int ans=0;
id=0;
for(int t=1;pw(t,k-1)<=n && t<=B;t++) p[++id]=pw(t,k);
int cur=1;
for(int i=1;i<=id;i++){
while(cur+1<=id && p[cur]<p[i]+n) cur++;
if(p[cur]==p[i]+n) ans++;
}
cout<<ans<<endl;
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
3 7 3 15 4 31 5
output:
1 1 1
result:
ok 3 number(s): "1 1 1"
Test #2:
score: -100
Wrong Answer
time: 107ms
memory: 19256kb
input:
20 409013310800583799 32 70368744177663 46 592570256192463681 4 360020145419649 5 357385021818058297 3 950227088646484702 56 127 7 718303642731669822 3 651621023623339377 45 405657994164855469 3 4095 12 288230376151711743 58 224251587219143167 5 2221626677255791 3 2953488086475199 4 6672460861685157...
output:
0 1 0 1 0 0 1 0 0 0 1 1 1 0 1 0 0 1 0 0
result:
wrong answer 3rd numbers differ - expected: '1', found: '0'