WA#9求大佬调%%%orz
查看原帖
WA#9求大佬调%%%orz
1175736
2166776037yyds楼主2024/8/5 10:49
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y,z,w;
	cin>>x>>y>>z>>w;
	if(z==0&&w==0) cout<<-1;
	else if(z==0&&y%w==0) cout<<y/w;
	else if(w==0&&x%z==0) cout<<x/z;
	else if(z!=0&&w!=0&&y/w==x/z&&y%w==0&&x%z==0) cout<<x/z;
	else cout<<-1;
	return 0;
}

错误情况

2024/8/5 10:49
加载中...