Plants vs. Zombies

Time Limit: 2000/1000ms (Java/Others)

Problem Description:

There is a zombie on your lawn,There is a zombie on your lawn,There are many zombies on your lawn,So can you defeat them?You have many plants that can kill the zombie in a hit and your plants can kill all zombies on their straight shooting path.

Input:

The input consists of several cases.The first line are two positive integer n,m,indicating the number of plants and zombies.Then the next n lines show the line (ax+by+c==0) of plants in the form of (a,b,c),Then the last lines show the positions of zombies in the form of (xi,yi).All input data is a 32-bit integer.

Output:

Print "duang" if you can kill all zombies,else print "eat your brain".

Sample Input:

2 2
1 1 1
1 2 3
1 -2 -1 0

Sample Output:

duang
解题思路:简单判断m个坐标是否都满足n个方程ax+by+c==0中的任意一个,如果都满足,则输出"duang",否则输出"eat your brain",水过!
AC代码:
 #include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6+;//开大一点
int n,m,num,x,y,a[maxn],b[maxn],c[maxn];
int main(){
while(~scanf("%d%d",&n,&m)){
for(int i=;i<n;++i)scanf("%d%d%d",&a[i],&b[i],&c[i]);
num=;
for(int j=;j<m;++j){
scanf("%d%d",&x,&y);
for(int i=;i<n;++i)
if(a[i]*x+b[i]*y+c[i]==){num++;break;}
}
if(num!=m)printf("eat your brain\n");
else printf("duang\n");
}
return ;
}

最新文章

  1. 前端 js 发送验证码
  2. C++11引用临时变量的终极解析
  3. HTML5实践 -- 使用CSS3 Media Queries实现响应式设计
  4. mongodb备份与恢复
  5. ODAC(V9.5.15) 学习笔记(十五)数据离线模式
  6. TYVJ P1015 公路乘车 &amp;&amp;洛谷 P1192 台阶问题 Label:dp
  7. 数据库.mdf
  8. HTML5自学笔记[ 19 ]canvas绘图实例之炫彩时钟
  9. Android滑动选择的日期选择框
  10. [上传下载] C# UpLoadFiles文件上传类 (转载)
  11. clientdataset&lt;----&gt;json
  12. ThinkPHP---RBAC
  13. android 自己定义开关(SwitchButton)
  14. zf-关于查询机把index.jsp换成index_new.jsp页面之后把功能链接都改成新页面的简单方法
  15. 新概念英语(1-57)An unusual day
  16. Codeforce Round #555 Div.3 D - N Problems During K Days
  17. 20175312 2018-2019-2 《Java程序设计》第8周学习总结
  18. 洛谷P1091 合唱队形
  19. Golang框架Beego在Windows环境下小试牛刀
  20. iostat iotop 查看硬盘的读写、 free 查看内存的命令 、netstat 命令查看网络、tcpdump 命令

热门文章

  1. Word Search(深度搜索DFS,参考)
  2. [Jexus系列] 一、安装并运行 Jexus
  3. Jenkins + SVN搭建php持续集成
  4. 【LeetCode-面试算法经典-Java实现】【067-Add Binary(二进制加法)】
  5. 【Akka】Actor模型探索
  6. Linux系统调用过程分析
  7. C++ auto 与 register、static keyword 浅析
  8. appium desktop
  9. ZOJ - 3471 Most Powerful (状态压缩)
  10. [计算机故障]华为手机无法连接XP系统(inf中找不到所需的段落)