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 ;
}

ACM_Plants vs. Zombies(一元一次方程)的更多相关文章

  1. 计算一元一次方程Y=kX+b

    开发过程中用不到一元一次方程吗?非也,iOS开发中经常会遇到根据某个ScrollView动态偏移量的值来实时设置一个View的透明度,你敢说你不用一元一次方程你能搞定? 想把一个动画效果做好,经常会遇 ...

  2. C++第9周(春)项目5 - 一元一次方程类

    课程首页在:http://blog.csdn.net/sxhelijian/article/details/11890759,内有完整教学方案及资源链接 [项目5]设计一元一次方程类.求形如ax+b= ...

  3. 通过C/C++,实现一元一次方程求解

    通过C/C++,实现一元一次方程求解: #include <bits/stdc++.h> using namespace std; string str, str_l, str_r; st ...

  4. python解一元一次方程

    将未知数看成是虚数 将常数看成是实数 最终求解. import re class Item: def __init__(self,imag=0,real=0): self.imag = imag se ...

  5. C#简易一元二次求解器

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  6. math & 三元一次方程组的解法

    math & 三元一次方程组的解法 class 6 math 例题 问题: 1. 已经做好的与没有做好的比例是 5 比 7; 2 再做好51,完成总数的 70%; 3. 问,一共要做多少朵花? ...

  7. 转载 什么是P问题、NP问题和NPC问题

    原文地址http://www.matrix67.com/blog/archives/105 这或许是众多OIer最大的误区之一.    你会经常看到网上出现“这怎么做,这不是NP问题吗”.“这个只有搜 ...

  8. codevs 1015 计算器的改良 2000年NOIP全国联赛普及组

     时间限制: 1 s  空间限制: 128000 KB  题目等级 : 白银 Silver 题目描述 Description NCL是一家专门从事计算器改良与升级的实验室,最近该实验室收到了某公司所委 ...

  9. luogu1022计算器的改良[noip2000提高组Day1 T1]

    题目背景 NCL是一家专门从事计算器改良与升级的实验室,最近该实验室收到了某公司所委托的一个任务:需要在该公司某型号的计算器上加上解一元一次方程的功能.实验室将这个任务交给了一个刚进入的新手ZL先生. ...

随机推荐

  1. [K/3Cloud] 分录行复制和新增行的冲突如何处理

    新增行:执行AfterCreateNewEntryRow,这个函数里面对一些数据进行处理(比如字段给上默认值): 复制行:复制行过程中希望这些字段能够得到我修改行信息后的数据,如果不处理,执行到Aft ...

  2. python之模块随笔记-sys

    模块名:sys sys.argv 实现从程序外部向程序传递参数 sys.path 返回模块的搜索路径,初始化时使用PYTHONPATH环境变量的值 sys.modules.keys() 返回所有已经导 ...

  3. POJ 2411_Mondriaan's Dream

    题意: 用1*2和2*1的方块将给定长宽的矩形填满.问有多少种放法,对称的算两种. 分析: 状态压缩dp 首先用0表示前一行没有竖块占用这个位置,而1表示该位置和他上方的位置放了一个竖块,从而压缩状态 ...

  4. Ubuntu 16.04下操作iptables的技巧(解决Failed to start iptables.service: Unit iptables.service not found.或者/etc/init.d/iptables: 没有那个文件或目录)

    /etc/init.d/iptables网上的解法应该都是基于CentOS 6去实践,而在CentOS 7中又被firewalld给取代,所以操作上的写法基本会改变,但是底层iptables则不会改变 ...

  5. SqlServer函数获取指定日期后的第某个工作日

    获取工作日 需要编写一个SqlServer函数,F_getWorkday,传入两个参数,第一个为时间date,第二个参数为第几个工作日num.调用F_getWorkday后返回date之后的第num个 ...

  6. TensorFlow-GPU环境配置之二——CUDA环境配置

    1.安装最新显卡驱动 到系统设置->软件和更新->附加驱动中选中最新的显卡驱动,并应用 2.下载CUDA8.0 https://developer.nvidia.com/cuda-down ...

  7. Ansible 2.0公布

    本文来源于我在InfoQ中文站翻译的文章,原文地址是:http://www.infoq.com/cn/news/2016/02/ansible-2-released 经过了一年的开发工作后,Ansib ...

  8. centos7grub2 引导win10

    centos7+win10安装完成之后,使用gurb2引导win10系统 方式:使用ntfs-3g 步骤: 1.加源  wget -O /etc/yum.repos.d/epel.repo http: ...

  9. 【c++】【转】C++ sizeof 使用规则及陷阱分析

    http://www.cnblogs.com/chio/archive/2007/06/11/778934.html sizeof不是函数,更像一个特殊的宏,它是在编译阶段求值得.sizeof作用范围 ...

  10. CCNA一些要点

    考试范围:     TK640-801(Cisco Certified Network Associate 640-801 ICND Course Notes).     信息单位:     1Byt ...