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. java中文乱码问题的处理方式

    URL访问java时. 注意: URL: 编码二次 URLEncoder.encode(URLEncoder.encode(searchKey, "utf-8"),"ut ...

  2. Writing Code-Codeforces511C**

    http://codeforces.com/problemset/problem/544/C 完全背包 dp[i][j]表示第i行有j个bug #include<stdio.h> #inc ...

  3. JDBC的Statement对象

    以下内容引用自http://wiki.jikexueyuan.com/project/jdbc/statements.html: 一旦获得了数据库的连接,就可以和数据库进行交互.JDBC的Statem ...

  4. 未能找出类型或命名空间名称“T” 问题的解决方案

    在已经引用“using System.Collections.Generic;”时,还是提示急未能找出类型或命名空间名称“T”的问题.

  5. 在gentoo中打开tomcat的远程调试开关

    在一般象gentoo等发行版中,系统安装tomcat这类软件后会产生一些启动脚本, 比如是/etc/init.d/tomcat-7, 启动方式与原始的tomcat不太一样.在gentoo中,假设须要远 ...

  6. String类的四个默认成员函数

    优化版的拷贝构造函数,先创建一个暂时实例tmp,接着把tmp._ptr和this->_ptr交换,因为tmp是一个局部变量.程序执行到该函数作用域外,就会自己主动调用析构函数.释放tmp._pt ...

  7. web 开发之js---js 多线程编程

    AJAX 开发中的难题 试试多线程编程 想了解更多 有关作者   转载注明出处:http://www.infoq.com/cn/articles/js_multithread 虽然有越来越多的网站在应 ...

  8. Android实现多个倒计时优化与源代码分析

    由于之前有个项目需求是须要时时刻去更新UI倒计时,之前想到的,这简单嘛,用计时或者Handler就能够搞定,并且性能也不错,可是需求要ListView,什么,?大量的View都须要,那Handle处理 ...

  9. HDU 4920(杭电多校训练#5 1010 题) Matrix multiplication(不知道该挂个什么帽子。。。)

    题目地址:pid=4920">HDU 4920 对这个题简直无语到极点. . .竟然O(n^3)的复杂度能过....方法有三.. 1:进行输入优化和输出优化. . (前提是你的输入优化 ...

  10. 关于The hierarchy of the type TestBeforeAdvice is inconsistent的问题

    今天准备写一个spring aop的demo,创建了TestBeforeAdvice类,该类实现了MethodBeforeAdvice接口,eclipse报了"The hierarchy o ...