UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214815#2835. 机器故障探测N300ms1276kbC++11625b2024-11-21 22:41:142024-11-22 09:37:49

answer

//
//  na 2835.cpp
//  Competitive Programming
//
//  Created by m2 on 2024/11/21.
//

#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
int n, m;
int main(){
    cin.tie(0)->sync_with_stdio(false);
    cin >> n >> m;
    if(m == n){
        cout << 0 << endl;
        return 0;
    }
    if(m == 1){
        for(int i = 1; ; ++i)
            if((1 << i) >= n){
                cout << i << endl;
                return 0;
            }
    }
    int ans = 0;
    for(int i = 1; i <= m; ++i)
        ans += log2(n - i + 1);
    cout << ans << endl;
    return 0;
}

详细

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

Test #1:

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

input:

6 2

output:

4

result:

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

Test #2:

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

input:

7 4

output:

8

result:

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

Test #3:

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

input:

8 2

output:

5

result:

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

Test #4:

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

input:

50 5

output:

25

result:

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

Test #5:

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

input:

49 3

output:

15

result:

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

Test #6:

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

input:

45 45

output:

0

result:

ok single line: '0'

Test #7:

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

input:

44 1

output:

6

result:

ok single line: '6'

Test #8:

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

input:

498 1

output:

9

result:

ok single line: '9'

Test #9:

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

input:

300 10

output:

80

result:

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

Test #10:

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

input:

500 23

output:

184

result:

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