HDU 3343

题目链接:题目


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 1
Sample 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;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值