我这算不算卡bug
查看原帖
我这算不算卡bug
1379298
陈小希2013楼主2024/11/9 13:05

我这算不算卡bug

#include<iostream>
using namespace std;

int main()
{
	int x, y, z, w;
	cin >> x >> y >> z >> w;
	if (z != 0)
	{
		if ((x / z) * w == y)
		{
			if (x / z == 0)
			{
				cout << "-1";
			}
			else
			{
				cout << x / z << endl;
			}
		}
		else
		{
			cout << -1 << endl;
		}
	}
	else if (w == 0)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << y / w << endl;
	}
	return 0;
}
2024/11/9 13:05
加载中...