ACM: O: Assignments
来源:互联网 发布:初创公司如何管理 知乎 编辑:程序博客网 时间:2024/06/03 22:55
ACM: O: Assignments
Description
When Starfleet headquarters gets a request for an exploration expedition, they need to determine which ship from those currently docked in the docking bay to send. They decide to send whichever ship is currently able to make the expedition based on how much fuel is currently stored on the ship as well as how long it will take the ship to arrive at the expected destination. Due to the age and current maintenance of the ships, each ship travels at a different top speed and has a different fuel consumption rate. Each ship reaches its top speed instantaneously.
Input
Input begins with a line with one integer T (1 ≤ T ≤ 50) denoting the number of test cases. Each test case begins with a line with two space-separated integers N and D, where N (1 ≤ N ≤ 100) denotes the number of ships in the docking bay and D (1 ≤ D ≤ 106) denotes the distance in lightyears to the expedition site. Next follow N lines with three space-separated integers vi, fi, and ci, where vi (1 ≤ vi ≤ 1000) denotes the top speed of ship i in light-years per hour, fi (1 ≤ fi ≤ 1000) denotes the fuel on ship i in kilos of deuterium, and ci (1 ≤ ci ≤ 1000) denotes the fuel consumption of ship i in kilos of deuterium per hour.
Output
For each test case, print a single integer on its own line denoting the number of ships capable of reaching the expedition site. Be careful with integer division!
Sample Input
23 10052 75 1088 13 4456 9 52 920368950 950 1943 976 1
Sample Output
21
注:题目虽然臭长臭长,但意思很简单,只要用距离除以速度再乘以每小时消耗,和总燃料比较即可。
#include <iostream>#include <cstdio>#include <cstring>#include <vector>#include <cmath>#include <algorithm>#include <string>#define LL long longusing namespace std;int main(){int T;int n,d;int v,f,c;cin>>T;
while(T--){
int count=0;cin>>n>>d;
for(int i=0;i<n;i++){
cin>>v>>f>>c;
if((double)(d*c)/v<=f)count++;
}
cout<<count<<endl;
}
return 0;}
- ACM: O: Assignments
- Assignments
- 2010acm区域赛(哈尔滨)--Assignments(贪心水题)
- Warning: Some pins have incomplete I/O assignments. Refer to the I/O Assignment Warnings report for
- ACM习题O-15
- 《ACM程序设计》O题
- ACM:O: 一二三
- I/O & Java in ACM
- ACM书中题目 O
- 《ACM书中题目》O
- 5.Operators and Assignments
- Nonoptimal Assignments(ZJU_2670)
- Editing Drive Letter Assignments
- spoj 423 Assignments
- 贪心-hdu-3661-Assignments
- hdu 3661 Assignments 贪心
- hdu Assignments(贪心)
- hdu 3661 Assignments【贪心】
- SQL Server审计功能入门:SQL Server审核 (SQL Server Audit)
- 一大堆excption
- [转载] Java Https SSL证书的PKIX问题
- dynamic_bitset
- mark
- ACM: O: Assignments
- Hadoop集群NameNode强制切换
- mybatis的xml映射文件SQL语句的增删改查、参数、缓存
- js 常用的函数(比较重要)
- Notice: Use of undefined constant id
- 学习【设计模式】从简单开始----------------单例模式
- JS 俄罗斯方块(不完美)
- 勒索(比特币)病毒的预防
- 详解OS X和iOS图像处理框架Core Image