QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#623030 | #5721. Dividing by Two | Rebuked | Compile Error | / | / | C++14 | 324b | 2024-10-09 09:41:34 | 2024-10-09 09:41:34 |
Judging History
answer
#include <iostream>
using namespace std;
int main() {
int a;
int b;
cin >> a >> b;
if(a == b) {
cout << "0";
} else if(b > a) {
cout << b-a;
} else {
if(a%b != 0) {
int count = 0;
while(a != b) {
++a;
a/=2;
if(a == b) {
++count;
break;
} else if(a<b) {
count += b-a;
break;
}
}
cout << count;
}
}
詳細信息
answer.code: In function ‘int main()’: answer.code:28:2: error: expected ‘}’ at end of input 28 | } | ^ answer.code:4:12: note: to match this ‘{’ 4 | int main() { | ^