中南月赛F ZZY and his little friends
Problem F: ZZY and his little friends
Time Limit: 5 Sec Memory Limit: 256 MB
Submit: 137 Solved: 70
[Submit][Status][Web Board]
Description
zzy养了一只小怪兽和N只凹凸曼,单挑的话每只凹凸曼都不是小怪兽的对手,所以必须由两只凹凸曼合作来和小怪兽战斗。凹凸曼A和凹凸曼B合作的战斗力为他们战斗力的异或值。现在由zzy从N只凹凸曼中选出两只来和小怪兽战斗。请问zzy能否选出两只凹凸曼使他们能够战胜小怪兽(他们的战斗力比小怪兽大)。
Input
输入有多个例子,直到文件结束。 每个例子的第一行含两个数N和M,表示有N(2<=N<=100000)只凹凸曼,小怪兽的战斗力为M(0<M<=1000000000)。接着有一行N个数,每个数Ai(0<Ai<M)表示每只凹凸曼的战斗力。
Output
对于每个例子输出一行,如果能选出两只凹凸曼使他们战胜小怪兽输出"YES", 否则输出"NO"(不含引号)
Sample Input
2 5
1 1
2 6
5 2
Sample Output
NO
YES
HINT
CSU_CX
直接暴力过的。不是标程方法。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std; int f[];
int main()
{
int n,m,flag;
int i,j;
while(scanf("%d%d",&n,&m)>)
{ for(i=;i<=n;i++)
scanf("%d",&f[i]);
flag=;
for(i=;i<=n;i++)
{
for(j=;j<=n;j++)
{
if((f[i]^f[j])>m)
{
flag=;
break;
}
}
if(flag==)break;
}
if(flag==) printf("YES\n");
else printf("NO\n");
}
return ;
}
中南月赛F ZZY and his little friends的更多相关文章
- 中南月赛 1313: ZZY的宠物
1313: ZZY的宠物 Time Limit: 2 Sec Memory Limit: 128 MBSubmit: 114 Solved: 59[Submit][Status][Web Boar ...
- 【BZOJ4953】lydsy七月月赛 F DP
[BZOJ4953]lydsy七月月赛 F 题面 题解:设f[i][j]表示第i个强度取为j时的最小误差.那么每次转移时,我们只计算j'和j之间的像素点带来的误差,于是有: $f[i][j]=min( ...
- csu 10月 月赛 F 题 ZZY and his little friends
一道字典树异或的题,但是数据比较水,被大家用暴力给干掉了! 以前写过一个类似的题,叫做the longest xor in tree: 两个差不多吧! 好久没写字典树了,复习一下! 代码: #incl ...
- 中南月赛 B题 Scoop water
Problem B: Scoop water Time Limit: 2 Sec Memory Limit: 128 MBSubmit: 261 Solved: 57[Submit][Status ...
- CSU 1325: A very hard problem 中南月赛的一道题。
1325: A very hard problem Time Limit: 3 Sec Memory Limit: 160 MBSubmit: 203 Solved: 53[Submit][Sta ...
- CSU 2018年12月月赛 F(2218): Finding prime numbers
Description xrdog has a number set. There are 95 numbers in this set. They all have something in com ...
- Contest2037 - CSU Monthly 2013 Oct(中南大学2013年10月月赛水题部分题解)
Problem A: Small change 题解:http://www.cnblogs.com/crazyapple/p/3349469.html Problem B: Scoop water 题 ...
- Mysql_以案例为基准之查询
查询数据操作
- 2017年中国大学生程序设计竞赛-中南地区赛暨第八届湘潭市大学生计算机程序设计大赛题解&源码(A.高斯消元,D,模拟,E,前缀和,F,LCS,H,Prim算法,I,胡搞,J,树状数组)
A------------------------------------------------------------------------------------ 题目链接:http://20 ...
随机推荐
- ORM的查询操作
查询的分类 class Author(models.Model): name = models.CharField(max_length=32) age = models.IntegerField() ...
- maven指定本地的文件包
maven指定本地的文件包 案例: <!-- CKFinder begin --> <dependency> <groupId>net.coobird</gr ...
- JMeterPlugin性能监控
GUI界面中的plugins manager中的jpgc-Standard set,其中共包含以下的文件: jpgc-dummy jpgc-fifo jpgc-graphs-basic jpgc-pe ...
- iOS学习笔记(6)——翻译苹果文档About Windows and Views
About Windows and Views 关于窗口和视图 In iOS, you use windows and views to present your application’s cont ...
- python3的全局变量和局部变量
局部变量 定义在函数体内部的变量称为局部变量 函数的形参也是局部变量 局部变量的作用范围只在声明该局部变量的函数体内 局部变量在函数调用时被创建,在函数调用完成后自动销毁 全局变量 定义在函数体外,模 ...
- Hexo博客系列(一)-Windows系统配置Hexo v3.x个人博客环境
[原文链接]:https://www.tecchen.xyz/blog-hexo-env-01.html 我的个人博客:https://www.tecchen.xyz,博文同步发布到博客园. 由于精力 ...
- 有道词典命令行查询工具(Mac/Ubuntu)
说明:此工具是基于node.js的,所以必须安装npm. 官网:https://github.com/kenshinji/yddict 安装: Mac: # 安装npm brew install np ...
- Java Web入门学习(二) Eclipse的配置
Java Web学习(二) Eclipse的配置 一.下载Eclipse 1.进入Eclipse官网,进行下载 上图,下载Eclipse IDE for JaveEE Developers 版本,然后 ...
- 【数组】Unique Paths
题目: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). ...
- JavaScript数据结构-7.链表
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...