UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214802#2835. 机器故障探测Filberte400ms1200kbC++111023b2024-11-21 21:34:132024-11-22 09:36:21

answer

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, m;cin >> n >> m;
    if(n == m){
        cout << 0;
        return 0;
    }
    if(m == 1){
        int p = 0, cur = 1;
        while(cur < n){
            cur <<= 1;
            p++;
        }
        cout << p << endl;
        return 0;
    }
    else if(m == 2){
        if(n == 1 || n == 2){
            cout << 0 << endl;
            return 0;
        }
        if(n == 3){
            cout << 2 << endl;
            return 0;
        }
        if(n == 4){
            cout << 3 << endl;
            return 0;
        }
        if(n == 5){
            cout << 4 << endl;
            return 0;
        }
        if(n == 6){
            cout << 5 << endl;
            return 0;
        }
        if(n == 7){
            cout << 5 << endl;
            return 0;
        }   
        if(n == 8){
            cout << 5 << endl;
            return 0;
        }
    }
    cout << 29 << endl;
    return 0;
}

详细

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

Test #1:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

6 2

output:

5

result:

ok single line: '5'

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 1196kb

input:

7 4

output:

29

result:

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

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 1200kb

input:

8 2

output:

5

result:

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

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 1196kb

input:

50 5

output:

29

result:

wrong answer 1st lines differ - expected: '24', found: '29'

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 1200kb

input:

49 3

output:

29

result:

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

Test #6:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

45 45

output:

0

result:

ok single line: '0'

Test #7:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

44 1

output:

6

result:

ok single line: '6'

Test #8:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

498 1

output:

9

result:

ok single line: '9'

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 1196kb

input:

300 10

output:

29

result:

wrong answer 1st lines differ - expected: '66', found: '29'

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 1200kb

input:

500 23

output:

29

result:

wrong answer 1st lines differ - expected: '143', found: '29'