poj 2366 Sacrament of the sum
来源:互联网 发布:软件购销合同书范本 编辑:程序博客网 时间:2024/06/09 19:47
题目连接:http://poj.org/problem?id=2366View Code
题意:给出一个N,N个数,一个M,M个数,问在N个数取一个数和M个数中取一个数加起来是否可能等于10000,范围是-32768~32767.
分析:水题,直接加40000,然后用数组记录就好。
代码:
#include<cstdio>#include<cmath>#include<cstring>#include<queue>#include<stack>#include<cstdlib>#include<string>#include<vector>#include<map>#include<string>#include<iostream>#include<algorithm>using namespace std;#define INF 0x3f3f3f3ftypedef long long ll;#define Max(a,b) (a>b)?a:b#define lowbit(x) x&(-x) int n,m,vis[1000000]={0},t,ff=0;int main(){ scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d",&t); vis[t+40000]=1; } scanf("%d",&m); for(int j=0;j<m;j++) { scanf("%d",&t); if(vis[50000-t]) ff=1; } if(ff) puts("YES"); else puts("NO");}
0 0
- poj 2366 Sacrament of the sum
- POJ - 2366 Sacrament of the sum
- poj 2366 Sacrament of the sum
- POJ 2366 Sacrament of the sum
- POJ 2366 Sacrament of the sum
- POJ 2366 Sacrament of the sum
- day2 POJ 2366 Sacrament of the sum
- poj 2366 Sacrament of the sum
- poj 2366 Sacrament of the sum
- POJ 2366 Sacrament of the sum(二分查找)
- POJ 2366 (URAL 1021)Sacrament of the Sum
- acm解题报告 POJ 2366 Sacrament of the sum
- POJ - 2366 Sacrament of the sum 二分查找
- Sacrament of the sum
- 1021. Sacrament of the Sum
- C - Sacrament of the sum
- poj 2366 Sacrament of the sum 尺取法的灵活运用
- 【二分查找】[POJ2366]Sacrament of the sum
- HDU 2059 龟兔赛跑 (dp) 代码+注释
- HDU 1028 Ignatius and the Princess III
- BZOJ 3173: [Tjoi2013]最长上升子序列
- poj 2365 Rope
- Hive分析窗口函数(五) GROUPING SETS,GROUPING__ID,CUBE,ROLLUP
- poj 2366 Sacrament of the sum
- poj 2367 Genealogical tree
- Apple Mach-O Linker (ld) Error Group
- poj 2368 Buttons
- poj 2369 Permutations
- poj 2370 Democracy in danger
- jmeter通过jmeter-plugins、jconsole对系统资源进行监控
- poj 2371 Questions and answers
- poj 2372 D++ Again