HDU 2317 Nasty Hacks
Nasty Hacks
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2299 Accepted Submission(s): 1816
to fool their friends. The company has just finished their first product and it is time to sell it. You want to make as much money as possible and consider advertising in order to increase sales. You get an analyst to predict the expected revenue, both with
and without advertising. You now want to make a decision as to whether you should advertise or not, given the expected revenues.
advertise, and the third, c, is the cost of advertising. You can assume that the input will follow these restrictions: -106 ≤ r, e ≤ 106 and 0 ≤ c ≤ 106.
3
0 100 70
100 130 30
-100 -70 40
advertise
does not matter
do not advertise
解题思路:继续水题。直接比較每行的三个数。假设第一个数大于第二个数减去第三个数,则须要做广告。若等于。就无所谓。否则。不做广告。
AC代码:
#include <iostream>
#include <cstdio>
using namespace std; int main(){
// freopen("in.txt", "r", stdin);
int n, a, b, c;
while(scanf("%d", &n)==1){
for(int i=0; i<n; i++){
scanf("%d%d%d", &a, &b, &c);
if(a < b - c) printf("advertise\n");
else if(a == b - c) printf("does not matter\n");
else printf("do not advertise\n");
}
}
return 0;
}
HDU 2317 Nasty Hacks的更多相关文章
- HDOJ(HDU) 2317 Nasty Hacks(比较、)
Problem Description You are the CEO of Nasty Hacks Inc., a company that creates small pieces of mali ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- Poj 3030 Nasty Hacks
1.Link: http://poj.org/problem?id=3030 2.Content: Nasty Hacks Time Limit: 1000MS Memory Limit: 655 ...
- Nasty Hacks <入门练手题>
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total S ...
- dir命令只显示文件名
dir /b 就是ls -f的效果 1057 -- FILE MAPPING_web_archive.7z 2007 多校模拟 - Google Search_web_archive.7z 2083 ...
- hdu2317Nasty Hacks
Problem Description You are the CEO of Nasty Hacks Inc., a company that creates small pieces of mali ...
- HOJ题目分类
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...
- POJ解题经验交流
感谢范意凯.陈申奥.庞可.杭业晟.王飞飏.周俊豪.沈逸轩等同学的收集整理. 题号:1003 Hangover求1/2+1/3+...1/n的和,问需多少项的和能超过给定的值 类似于Zerojudg ...
- OJ题解记录计划
容错声明: ①题目选自https://acm.ecnu.edu.cn/,不再检查题目删改情况 ②所有代码仅代表个人AC提交,不保证解法无误 E0001 A+B Problem First AC: 2 ...
随机推荐
- pytorch 加载数据集
pytorch初学者,想加载自己的数据,了解了一下数据类型.维度等信息,方便以后加载其他数据. 1 torchvision.transforms实现数据预处理 transforms.Totensor( ...
- PAT Basic 1031
1031 查验身份证(15)(15 分) 一个合法的身份证号码由17位地区.日期编号和顺序编号加1位校验码组成.校验码的计算规则如下: 首先对前17位数字加权求和,权重分配为:{7,9,10,5,8, ...
- 学习javascript中的事件——事件流
事件概念: HTML中与javascript交互是通过事件驱动来实现的,例如鼠标点击事件onclick.页面的滚动事件onscroll等等,可以向文档或者文档中的元素添加事件侦听器来预订事件.想要知道 ...
- Python开发:面向对象
Python从设计之初就已经是一门面向对象的语言,正因为如此,在Python中创建一个类和对象是很容易的. 如果你以前没有接触过面向对象的编程语言,那你可能需要先了解一些面向对象语言的一些基本特征,在 ...
- iphone数据库(sqlite3)的用法操作oc,xcode
首先你在用之前要在项目中加入libsqlite3.dylib 1.定义模型 [cpp] #import <Foundation/Foundation.h> #import " ...
- windows phone 网络开发三部曲(一)各种包的各种抓法
首先感谢大家对我上一篇博客的支持,让我也体验了一把上榜的感觉. 这无疑是对我这个刚刚打算,认真写写博客的人的莫大的鼓励,再次感谢(鞠躬)!! 接下来想和大家分享一些关于windows phone网络开 ...
- ORA-02437 违反主键
在给study用户下的semp表建立主键的时候,出现以下错误:SQL> alter table semp add constraint pk_emp primary key(empno);alt ...
- php(ajax)异步刷新(转)
第一种方法,ajax实现:当然,ajax使用起来确实很简单就可以实现,但是里面的很多知识还是比较有点深的.我之前做页面时间自动刷新的功能就是用的ajax.完整代码是:1.getTime.php: 复制 ...
- 九度oj 题目1109:连通图
题目描述: 给定一个无向图和其中的所有边,判断这个图是否所有顶点都是连通的. 输入: 每组数据的第一行是两个整数 n 和 m(0<=n<=1000).n 表示图的顶点数目,m 表示图中边的 ...
- OkHttpUtil
package jp.co.gunmabank.util import android.os.Handlerimport android.os.Looperimport com.google.gson ...