ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214806 | #2835. 机器故障探测 | naroto2022 | 20 | 0ms | 1124kb | C++ | 670b | 2024-11-21 21:54:06 | 2024-11-22 09:36:43 |
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
using namespace std;
ll n,m,ans;
void write(ll n){if(n<0){putchar('-');write(-n);return;}if(n>9)write(n/10);putchar(n%10+'0');}
ll read(){ll x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
int main(){
n=read();m=read();
if(n==m){write(n);return 0;}
if(m==1) for(int i=1; i<=n; i++) if((1<<i)>=n){write(i);return 0;}
for(int i=1; i<=n; i++) if((1<<i)>=n){ans=i;break;}
write(ans*(m-1)+1);putchar('\n');
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1120kb
input:
6 2
output:
4
result:
wrong answer 1st lines differ - expected: '5', found: '4'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 1120kb
input:
7 4
output:
10
result:
wrong answer 1st lines differ - expected: '6', found: '10'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 1124kb
input:
8 2
output:
4
result:
wrong answer 1st lines differ - expected: '6', found: '4'
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 1124kb
input:
50 5
output:
25
result:
wrong answer 1st lines differ - expected: '24', found: '25'
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 1124kb
input:
49 3
output:
13
result:
wrong answer 1st lines differ - expected: '16', found: '13'
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 1120kb
input:
45 45
output:
45
result:
wrong answer 1st lines differ - expected: '0', found: '45'
Test #7:
score: 10
Accepted
time: 0ms
memory: 1124kb
input:
44 1
output:
6
result:
ok single line: '6'
Test #8:
score: 10
Accepted
time: 0ms
memory: 1124kb
input:
498 1
output:
9
result:
ok single line: '9'
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 1124kb
input:
300 10
output:
82
result:
wrong answer 1st lines differ - expected: '66', found: '82'
Test #10:
score: 0
Wrong Answer
time: 0ms
memory: 1124kb
input:
500 23
output:
199
result:
wrong answer 1st lines differ - expected: '143', found: '199'