博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #564 (Div. 2) A. Nauuo and Votes
阅读量:6115 次
发布时间:2019-06-21

本文共 1528 字,大约阅读时间需要 5 分钟。

链接:

题意:

Nauuo is a girl who loves writing comments.

One day, she posted a comment on Codeforces, wondering whether she would get upvotes or downvotes.

It's known that there were xx persons who would upvote, yy persons who would downvote, and there were also another zz persons who would vote, but you don't know whether they would upvote or downvote. Note that each of the x+y+zx+y+z people would vote exactly one time.

There are three different results: if there are more people upvote than downvote, the result will be "+"; if there are more people downvote than upvote, the result will be "-"; otherwise the result will be "0".

Because of the zz unknown persons, the result may be uncertain (i.e. there are more than one possible results). More formally, the result is uncertain if and only if there exist two different situations of how the zz persons vote, that the results are different in the two situations.

Tell Nauuo the result or report that the result is uncertain.

思路:

x-y的绝对值大于z就有稳定的答案,想同时特判z等于0.

代码:

#include 
using namespace std;typedef long long LL;const int MAXN = 1e5 + 10;const int MOD = 1e9 + 7;int n, m, k, t;int main(){// freopen("test.in", "r", stdin); int x, y, z; cin >> x >> y >> z; if (z < abs(x - y) || z == 0) { if (x > y) cout << "+" << endl; else if (y > x) cout << "-" << endl; else cout << "0" << endl; } else cout << "?" << endl; return 0;}

  

转载于:https://www.cnblogs.com/YDDDD/p/10990861.html

你可能感兴趣的文章
Go语言学习(五)----- 数组
查看>>
Android源码学习之观察者模式应用
查看>>
Content Provider的权限
查看>>
416. Partition Equal Subset Sum
查看>>
centos7.0 64位系统安装 nginx
查看>>
数据库运维平台~自动化上线审核需求
查看>>
注解开发
查看>>
如何用 Robotframework 来编写优秀的测试用例
查看>>
Django之FBV与CBV
查看>>
Vue之项目搭建
查看>>
app内部H5测试点总结
查看>>
Docker - 创建支持SSH服务的容器镜像
查看>>
[TC13761]Mutalisk
查看>>
三级菜单
查看>>
Data Wrangling文摘:Non-tidy-data
查看>>
加解密算法、消息摘要、消息认证技术、数字签名与公钥证书
查看>>
while()
查看>>
常用限制input的方法
查看>>
Ext Js简单事件处理和对象作用域
查看>>
IIS7下使用urlrewriter.dll配置
查看>>