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. 类(Class)

    类 · 目的 面向对象的最主要目的是提高程序的重复使用性. · 包括 属性(attribute).方法(method) · 示例 class Bird(object): have_feather = ...

  2. Balance POJ - 1837 地推

    Gigel has a strange "balance" and he wants to poise it. Actually, the device is different ...

  3. spring 数据源JNDI 基于tomcat mysql配置

    关键代码 <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean&q ...

  4. JAVA 流程控制之选择语句

    在程序设计时,有三种基本技术可以改变程序的流程控制: 调用方法: 选择: 循环. 在这里,我们主要来讲讲选择语句. JAVA中的选择语句与C语言中的基本相同,包括: if 语句: if/else 语句 ...

  5. oralce之复杂查询举例

    表结构: S(SNO,SNAME) 代表 学号.学生姓名: C(CNO,CNAME,CTEACHER) 代表 课号,课程名称.授课老师 SC(SNO,CNO,SCGRADE) 代表 学号.课号.课程成 ...

  6. jQuery整理笔记七----几个经典表单应用

    1.文本框获得(失去)焦点 当文本框获得输入焦点时,将该文本框高亮显示,算不得一个应用,仅仅是一个小技巧,能够提高用户体验. <!DOCTYPE html PUBLIC "-//W3C ...

  7. webpack-入口篇

    入口起点[Entry Points]: 单个入口(简写)语法 用法:entry: string|Array<string> 例子(webpack.config.js) const conf ...

  8. opencv基础笔记(1)

    为了细致掌握程明明CVPR 2014 oral文章:BING: Binarized Normed Gradients for Objectness Estimation at 300fps的代码,的好 ...

  9. iOS 特定图片的button的旋转动画

    近期做的东西中,要为一个有特定图片的button加入旋转动画,Demo代码例如以下: #import "ViewController.h" @interface ViewContr ...

  10. Mac SavePanel 保存文件的GUI代码

    // Move the recorded temporary file to a user-specified location (视频文件另存储过程,依据用户选择的路径和文件保存名) NSSaveP ...