也是水题了,不过注意负负也可以为正就好了。

今天看见bestcoder上的人那么厉害,唉,我什么时候才能赶上啊。。

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define LL __int64
using namespace std; int main(){
int T,n,Case=0;
double k1,k2,k,sum,t;
scanf("%d",&T);
while(T--){
sum=0;
scanf("%d%lf%lf%lf",&n,&k1,&k2,&k);
for(int i=1;i<=n;i++){
scanf("%lf",&t);
sum+=t;
}
k1+=k2;
printf("Case #%d: ",++Case);
if(sum>k){
puts("0");
}
else if(fabs(k1)<=1)
puts("inf");
else{
int ans=0;
while(true){
ans++;
sum*=k1;
if(sum>k) break;
}
printf("%d\n",ans);
}
}
return 0;
}

  

HDU 4525的更多相关文章

  1. hdu 4525(数学)

    威威猫系列故事——吃鸡腿 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Tota ...

  2. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  3. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  4. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  5. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  6. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  7. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  8. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  9. hdu 4481 Time travel(高斯求期望)(转)

    (转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...

随机推荐

  1. html 基础演示代码

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...

  2. Unicode ,UTF-8,assic, gbk, latin1编码 的区别

    1. ASCII码 我们知道,在计算机内部,所有的信息最终都表示为一个二进制的字符串.每一个二进制位(bit)有0和1两种状态,因此八个二进制位就可以组合出256种状态,这被称为一个字节(byte). ...

  3. [转]linux tr命令详解

    转自:http://www.cnblogs.com/huangxingkezhan/archive/2013/01/23/2874031.html 通过使用 tr,您可以非常容易地实现 sed 的许多 ...

  4. cocos2d-js 开发常见问题

    1. 编译android版本可能出现的问题记录 如果编译的时候报错.出现/platforms/android-14/arch-arm/usr/lib/crtend_so.o: Unknown EABI ...

  5. JAVA FORK JOIN EXAMPLE--转

    http://www.javacreed.com/java-fork-join-example/ Java 7 introduced a new type of ExecutorService (Ja ...

  6. jQuery制作顶部与左侧锚点板块定位功能带动画跳转特效

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. 自己写一个爬虫 copider

    copider 模仿scrapy的一些写法,当然我这个是单进程的,不是异步的 1.目录 copider/copider.py #coding=utf-8 ''' Created on 2015年10月 ...

  8. mvc EF 出现异常, 能提示出那个字段出现问题

    } catch (DbEntityValidationException ex) { message = "添加异常"; desc = " {" + ex.Me ...

  9. PHP 之微信小程序支付封装

    <?php /** * Created by PhpStorm. * User: yangs * Date: 2019/4/26 * Time: 14:28 */ class WeixinPay ...

  10. sql的四种连接方式

    1.内联接.(典型的联接运算,使用像 =  或 <> 之类的比较运算符).包括相等联接和自然联接. 内联接使用比较运算符根据每个表共有的列的值匹配两个表中的行.例如,检索 students ...