UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214380#2678. Small Multipleyiwei306612ms1208kbC++11408b2024-11-18 19:12:302024-11-19 08:27:43

answer

#include <bits/stdc++.h>
using namespace std;

#define Int __int128

int k,m;

int f(Int x){
    int s = 0;
    while (x){
        s += x % m;
        x /= m;
    }
    return s;
}

int main(){
    cin >> k >> m;
    Int t = k; int ans = INT_MAX;
    while ((double)clock() < 0.97 * CLOCKS_PER_SEC){
        ans = min(ans,f(t));
        t += k;
    }
    cout << ans;
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 5
Accepted
time: 278ms
memory: 1208kb

input:

32 4

output:

1

result:

ok single line: '1'

Test #2:

score: 5
Accepted
time: 263ms
memory: 1204kb

input:

25 6

output:

5

result:

ok single line: '5'

Test #3:

score: 5
Accepted
time: 379ms
memory: 1204kb

input:

19 3

output:

2

result:

ok single line: '2'

Test #4:

score: 5
Accepted
time: 275ms
memory: 1204kb

input:

64 7

output:

4

result:

ok single line: '4'

Test #5:

score: 0
Wrong Answer
time: 229ms
memory: 1204kb

input:

86 10

output:

4

result:

wrong answer 1st lines differ - expected: '3', found: '4'

Test #6:

score: 5
Accepted
time: 401ms
memory: 1204kb

input:

17 2

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Wrong Answer
time: 264ms
memory: 1204kb

input:

937761 10

output:

12

result:

wrong answer 1st lines differ - expected: '6', found: '12'

Test #8:

score: 0
Wrong Answer
time: 341ms
memory: 1208kb

input:

788944 8

output:

8

result:

wrong answer 1st lines differ - expected: '4', found: '8'

Test #9:

score: 0
Wrong Answer
time: 415ms
memory: 1208kb

input:

573314 3

output:

8

result:

wrong answer 1st lines differ - expected: '4', found: '8'

Test #10:

score: 0
Wrong Answer
time: 369ms
memory: 1204kb

input:

785883 5

output:

9

result:

wrong answer 1st lines differ - expected: '2', found: '9'

Test #11:

score: 0
Wrong Answer
time: 272ms
memory: 1208kb

input:

769025 7

output:

9

result:

wrong answer 1st lines differ - expected: '6', found: '9'

Test #12:

score: 0
Wrong Answer
time: 388ms
memory: 1204kb

input:

909894 4

output:

9

result:

wrong answer 1st lines differ - expected: '3', found: '9'

Test #13:

score: 0
Wrong Answer
time: 335ms
memory: 1208kb

input:

585472 9

output:

16

result:

wrong answer 1st lines differ - expected: '8', found: '16'

Test #14:

score: 0
Wrong Answer
time: 324ms
memory: 1208kb

input:

795020 5

output:

8

result:

wrong answer 1st lines differ - expected: '4', found: '8'

Test #15:

score: 0
Wrong Answer
time: 300ms
memory: 1208kb

input:

514716 8

output:

8

result:

wrong answer 1st lines differ - expected: '3', found: '8'

Test #16:

score: 0
Wrong Answer
time: 364ms
memory: 1204kb

input:

984458 5

output:

8

result:

wrong answer 1st lines differ - expected: '4', found: '8'

Test #17:

score: 5
Accepted
time: 474ms
memory: 1208kb

input:

645285 2

output:

4

result:

ok single line: '4'

Test #18:

score: 0
Wrong Answer
time: 327ms
memory: 1208kb

input:

694328 9

output:

16

result:

wrong answer 1st lines differ - expected: '8', found: '16'

Test #19:

score: 0
Wrong Answer
time: 307ms
memory: 1204kb

input:

698907 6

output:

8

result:

wrong answer 1st lines differ - expected: '2', found: '8'

Test #20:

score: 0
Wrong Answer
time: 307ms
memory: 1208kb

input:

994036 7

output:

10

result:

wrong answer 1st lines differ - expected: '2', found: '10'