#include <iostream>
using namespace std;
int main()
{
int a,b,c;
while(cin >> a)
{
cin >> b;
while(a>b)
{
c=a;
a=b;
b=c;
break;
}
while(a%2!=0)
{
while(b%2==0)
{
cout << (b-a)/2+1 <<endl;
break;
}
while(b%2!=0)
{
cout << (b-a)/2 <<endl;
break;
}
break;
}
while(a%2==0)
{
while(b%2==0)
{
while(a==b)
{
cout << 2 << endl;
break;
}
while(a!=b)
{
cout << (b-a)/2+1 <<endl;
break;
}
break;
}
while(b%2!=0)
{
cout << (b-a)/2+1 <<endl;
break;
}
break;
}
}
return 0;
}
知道別的作法,但不知道是哪個情形沒設到
只錯這兩題
您的答案為: 2 正確答案為: 1
您的答案為: 2 正確答案為: 1