ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214392 | #2678. Small Multiple | a_sad_soul | 35 | 4752ms | 1188kb | C++11 | 325b | 2024-11-18 19:45:15 | 2024-11-19 08:29:45 |
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll k,m;
ll calc(ll x,ll k){
ll re=0;
while(x){
re+=x%k;x/=k;
}
return re;
}
int main(){
cin>>k>>m;
ll ans=1e18;
for(ll i=1;i<=1e6;++i)ans=min(ans,calc(i*k,m));
printf("%lld\n",ans);
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 5
Accepted
time: 189ms
memory: 1188kb
input:
32 4
output:
1
result:
ok single line: '1'
Test #2:
score: 5
Accepted
time: 146ms
memory: 1188kb
input:
25 6
output:
5
result:
ok single line: '5'
Test #3:
score: 5
Accepted
time: 219ms
memory: 1188kb
input:
19 3
output:
2
result:
ok single line: '2'
Test #4:
score: 5
Accepted
time: 131ms
memory: 1184kb
input:
64 7
output:
4
result:
ok single line: '4'
Test #5:
score: 0
Wrong Answer
time: 110ms
memory: 1188kb
input:
86 10
output:
4
result:
wrong answer 1st lines differ - expected: '3', found: '4'
Test #6:
score: 5
Accepted
time: 339ms
memory: 1184kb
input:
17 2
output:
2
result:
ok single line: '2'
Test #7:
score: 0
Wrong Answer
time: 174ms
memory: 1188kb
input:
937761 10
output:
12
result:
wrong answer 1st lines differ - expected: '6', found: '12'
Test #8:
score: 0
Wrong Answer
time: 198ms
memory: 1188kb
input:
788944 8
output:
8
result:
wrong answer 1st lines differ - expected: '4', found: '8'
Test #9:
score: 0
Wrong Answer
time: 381ms
memory: 1188kb
input:
573314 3
output:
8
result:
wrong answer 1st lines differ - expected: '4', found: '8'
Test #10:
score: 0
Wrong Answer
time: 253ms
memory: 1188kb
input:
785883 5
output:
9
result:
wrong answer 1st lines differ - expected: '2', found: '9'
Test #11:
score: 0
Wrong Answer
time: 209ms
memory: 1188kb
input:
769025 7
output:
9
result:
wrong answer 1st lines differ - expected: '6', found: '9'
Test #12:
score: 0
Wrong Answer
time: 296ms
memory: 1188kb
input:
909894 4
output:
9
result:
wrong answer 1st lines differ - expected: '3', found: '9'
Test #13:
score: 0
Wrong Answer
time: 193ms
memory: 1184kb
input:
585472 9
output:
16
result:
wrong answer 1st lines differ - expected: '8', found: '16'
Test #14:
score: 5
Accepted
time: 258ms
memory: 1184kb
input:
795020 5
output:
4
result:
ok single line: '4'
Test #15:
score: 0
Wrong Answer
time: 189ms
memory: 1188kb
input:
514716 8
output:
8
result:
wrong answer 1st lines differ - expected: '3', found: '8'
Test #16:
score: 0
Wrong Answer
time: 255ms
memory: 1184kb
input:
984458 5
output:
8
result:
wrong answer 1st lines differ - expected: '4', found: '8'
Test #17:
score: 5
Accepted
time: 591ms
memory: 1184kb
input:
645285 2
output:
4
result:
ok single line: '4'
Test #18:
score: 0
Wrong Answer
time: 184ms
memory: 1188kb
input:
694328 9
output:
16
result:
wrong answer 1st lines differ - expected: '8', found: '16'
Test #19:
score: 0
Wrong Answer
time: 226ms
memory: 1188kb
input:
698907 6
output:
8
result:
wrong answer 1st lines differ - expected: '2', found: '8'
Test #20:
score: 0
Wrong Answer
time: 211ms
memory: 1188kb
input:
994036 7
output:
10
result:
wrong answer 1st lines differ - expected: '2', found: '10'