UVALive 6275 (ACM-ICPC Live Archive: 6275 ) Joint Venture(二分)
来源:互联网 发布:身份证的正则表达式js 编辑:程序博客网 时间:2024/05/11 13:04
Sample Input
1
4
9999998
1
2
9999999
Sample Output
yes 1 9999999
AC代码:
#include <cstdio>#include <algorithm>#include <iostream>using namespace std;#define MAX 1000100//author:XXYYint L[MAX];int main(){int X,n,l,r,flag,i;while(~scanf("%d",&X)){X*=10000000;scanf("%d",&n);flag=0;for(i=0;i<n;i++)scanf("%d",&L[i]);if(!n||n==1){printf("danger\n");continue;}sort(L,L+n);l=0;r=n-1;while(l<r){if(L[l]+L[r]==X){flag=1;printf("yes %d %d\n",L[l],L[r]);break;}else if(L[l]+L[r]<X)l++;elser--;}if(!flag)printf("danger\n");}return 0;}
0 0
- UVALive 6275 (ACM-ICPC Live Archive: 6275 ) Joint Venture(二分)
- UVALive 6275 Joint Venture(查找等值)
- ACM-ICPC Live Archive 6505---Metal(二分)
- LA 6275 Joint Venture 二分查找,判重
- UVALive 6270 (ACM-ICPC Live Archive: 6270) Edge Case(大数斐波那契)
- ACM-ICPC Live Archive 6139 - Interval Product (线段树-点更新)
- ACM-ICPC Live Archive 2031 - Dance Dance Revolution(状态dp)
- ACM-ICPC Live Archive 6811 - Irrigation Lines
- NWERC 2012 Joint Venture (二分+枚举)
- ACM-ICPC Live Archive 第4889题 Post Office
- ACM-ICPC Live Archive - Home 4329 - Ping pong
- acm/icpc live archive 2481, world final 2002 problem h. silly sort
- acm/icpc live archive regional 1998 europe central problem d, spoj 45 commedia dell arte
- ACM-ICPC Live Archive Regionals 2014 >> 重拾2014上海区域赛
- Joint Venture - JV
- 2016 ACM/ICPC 青岛网赛 1001(预处理+二分)
- UVALive 7061 Dire Wolf (dp)(The 2014 ACM-ICPC Asia Beijing Regional Contest D)
- UVALive 7505 Hungry Game of Ants ACM/ICPC ECFinal 2015(dp+思维)
- SingleTon - 单例模式
- 高精度运算类bign
- Entity Framework 错误
- 错,易错,容易错的地方:fopen的r+,malloc连续内存,net start mysql与netstat -ano,GetCurrentProcess和malloc的头文件
- SQL实现远程备份本保存备份文件到本地
- UVALive 6275 (ACM-ICPC Live Archive: 6275 ) Joint Venture(二分)
- /dev: 目录
- NOJ1094蛇形填数——想法
- 介绍一下linux的文件系统
- 经典-动态规划-嵌套矩阵
- Binary Tree Level Order Traversal
- 硬盘读写能力测试
- 利用&&运算特性求和
- 计算机网络学习心得(一)