#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{int a,b,c;
cin >>a>>b;
if(a==0)
{
c=(b-a)/2;
cout <<c+1;
}
else if (b>a)
{
c=(b-a)/2;
if((b-a)%2!=0)
{cout <<c+1;}
if((b-a)%2==0)
{cout <<c;}
}
else
cout <<0;
//system("pause");
return 0;
}
#include
#include
using namespace std;
int main()
{int a,b,c;
cin >>a>>b;if(a==0)
{
c=(b-a)/2;
cout <}
else if (b>a)
{
c=(b-a)/2;if((b-a)%2!=0)
{cout <if((b-a)%2==0)
{cout <}
else
cout <<0;
//system("pause");
return 0;
}
把int改用long long int試試
#include
#include
using namespace std;
int main()
{int a,b,c;
cin >>a>>b;if(a==0)
{
c=(b-a)/2;
cout <}
else if (b>a)
{
c=(b-a)/2;if((b-a)%2!=0)
{cout <if((b-a)%2==0)
{cout <}
else
cout <<0;
//system("pause");
return 0;
}把int改用long long int試試
謝謝