A. Find Extra One
来源:互联网 发布:js window.scrollbars 编辑:程序博客网 时间:2024/05/22 02:15
You have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining points are located on one side of the OY axis.
The first line contains a single positive integer n (2 ≤ n ≤ 105).
The following n lines contain coordinates of the points. The i-th of these lines contains two single integers xi and yi (|xi|, |yi| ≤ 109, xi ≠ 0). No two points coincide.
Print "Yes" if there is such a point, "No" — otherwise.
You can print every letter in any case (upper or lower).
31 1-1 -12 -1
Yes
41 12 2-1 1-2 2
No
31 22 14 60
Yes
In the first example the second point can be removed.
In the second example there is no suitable for the condition point.
In the third example any point can be removed.
解题说明:水题,判断去除一个点后其他点是否都在第一象限
#include<cstdio>#include<iostream>#include<string>#include<cstring>#include<cmath>using namespace std;int main(){int a, b, n, i, A = 0, B = 0;scanf("%d", &n);for (i = 1; i <= n; i++){scanf("%d%d", &a, &b);if (a < 0){A++;}else{B++;}}if (A <= 1 || B <= 1){printf("yes\n");}else{printf("no\n");}return 0;}
- A. Find Extra One
- codeforces 900A. Find Extra One
- 900AFind Extra One
- Find Extra One_Codeforces_900A
- A - Extra-terrestrial Intelligence
- A. Extra-terrestrial Intelligence
- hdu 1503, LCS variants, find a LCS, not just the length, backtrack to find LCS, no extra markup
- codeforces Remove Extra One(思维)
- CF#450 C.Remove Extra One
- codeforces 900C. Remove Extra One
- CF900C:Remove Extra One(思维)
- Codeforces 900C-Remove Extra One
- Codeforces 900C Remove Extra One
- codeforces 900C. Remove Extra One
- Extra
- Add One Bool Field to Player Extra Field
- CF 900.C Remove Extra One 单调栈+BIT
- Codeforces Round #450 (Div. 2) C. Remove Extra One 暴力
- ue4当中材质自定义uv和多套uv
- Opencv+Zbar二维码识别(二维码校正)
- SpringBoot启动流程简析(三)
- python 第五课
- Effective Java读书笔记——创建和销毁对象
- A. Find Extra One
- 机器学习和深度学习入门问题形象解答
- 线性代数 02.05 矩阵习题课
- 切换至tab_2通讯录界面时有一部分位置闪黑屏
- MFC 防止多线程卡死
- 社会工程学工具集
- IDEA热部署配置
- SQL注入详解
- Opencv+Zbar二维码识别(标准条形码/二维码识别)