题解 CF1173A 【Nauuo and Votes】
StudyingFather
2019-06-08 02:20:33
**Unofficial Solution to this contest also available in [Studying Father's Blog](https://studyingfather.com/archives/1304).**
------
对不确定投票的 $ z $ 人,贪心地考虑两种极端情况:全部赞成或全部反对。分别计算这两种情况下的得票情况。
如果这两种情况下得票状况相同,则可以确定得票情况,否则不能确定。
```cpp
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
int res1=x-y+z,res2=x-y-z;
if(res1<0)res1=-1;
else if(res1>0)res1=1;
if(res2<0)res2=-1;
else if(res2>0)res2=1;
if(res1!=res2)puts("?");
else if(!res1)puts("0");
else if(res1>0)puts("+");
else puts("-");
return 0;
}
```