题目链接:题目
Long long ago, there is an ant crawling on an L-meter magic rubber band with speed of v cm/s.The magic rubber band will elongate m meters every second. We can assume that the magic rubber band elongates equably. Now, the ant is on the start point and crawling to another point, please tell me whether it can reach the endpoint.
InputThe first line of the input is T, which stands for the number of test cases you need to solve.
Each case include three integers: L , v , m ( 0< L< 10^9,0<= v, m< 10^ 9,).OutputFor each test case, if the ant can reach endpoint, output "YES", otherwise "NO".Sample Input
1 99999 61 1Sample Output
YES
思路:假设蚂蚁在距离左端点 L1 并且在距离右端点 L2 处,设 L3 = L1 + L2, k = L1 / L3 ; 假设蚂蚁不动的话,则 k 值不变。因为蚂蚁向右走,所以 k 在一直增大。。。所以 k 一定可以到 1 即 L1 == L3,也就是说只要蚂蚁向右走,就一定可以到右端点!
#include<cstdio>
using namespace std;
int main()
{
int l,v,c,t;
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d",&l,&v,&c);
if(v>0)
printf("YES\n");
else printf("NO\n");
}
return 0;
}