题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4823

题意:中文题,很清楚,要注意的是乘起来会爆int

题解:

 #include<cstdio>
int main(){
long long t,n,m,v,k,ans,pre;
scanf("%d",&t);
while(t--){
scanf("%I64d%I64d%I64d%I64d",&n,&m,&v,&k);
if(m>=n)printf("0\n");
else{
ans=,pre=-;
while(m<n&&m>=v&&pre!=m){pre=m,m=(m-v)*k,ans++;}
if(m>=n)printf("%I64d\n",ans);
else printf("-1\n");
}
}
return ;
}

hdu_4823_Energy Conversion的更多相关文章

  1. Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ...

    Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ... 这个错误是因为有两个相 ...

  2. View and Data API Tips : Conversion between DbId and node

    By Daniel Du In View and Data client side API, The assets in the Autodesk Viewer have an object tree ...

  3. 【leetcode】ZigZag Conversion

    题目简述 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows ...

  4. Conversion Operators in OpenCascade

    Conversion Operators in OpenCascade eryar@163.com Abstract. C++ lets us redefine the meaning of the ...

  5. No.006:ZigZag Conversion

    问题: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows l ...

  6. 错误提示:LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt 的解决方法

    最近在win7 系统下,打算利用 cmake 生成项目文件,然后用vs2010进行编译.但是在cmake的时候出现错误弹窗:

  7. ZigZag Conversion leetcode java

    题目: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows l ...

  8. VS2010 LINK1123:failure during conversion to COFF:file invalid or corrupt

    今天用Visual Studio 2010编译一个C工程时突然遇到下面这个编译错误.fatal error LINK1123:failure during conversion to COFF:fil ...

  9. 【leetcode❤python】 6. ZigZag Conversion

    #-*- coding: UTF-8 -*- #ZigZag Conversion :之字型class Solution(object):    def convert(self, s, numRow ...

随机推荐

  1. @Scheduled(cron = "0 0 * * * ?")实现定时任务

    //每一个小时执行一次 @Scheduled(cron = "0 0 * * * ?") public void saveDailyScoreScheduled() { try { ...

  2. eclipse怎么连接到MySQL中的表!!!!!

    简介: 用eclipse编写的好的代码,我们怎么才能连接到数据库呢?对于初学者,特别是在连接数据库这块经常会发生一些莫名的错误,一般来说,归根是我们连接数据库这一过程发生错误.那么我们如何来解决呢?那 ...

  3. Centos6.3手动rpm安装gcc,c++

    如果你的服务器是不能上网的,那就说明你要手动安装很多软件,比如gcc; 1,首先到http://vault.centos.org/6.3/os/x86_64/Packages/下载用到的rpm包,包括 ...

  4. android设置组件透明度

    textremind.setBackgroundColor(Color.argb(178, 0, 0, 0));  //背景透明度 textremind.setTextColor(Color.argb ...

  5. IE中float元素如果同时设置了margin值,此时margin的值会变为双倍的解决方法

    IE中float元素如果同时设置了margin值,此时margin的值会变为双倍, 解决办法: 是在该元素中加入display:inline.

  6. 关于 plsql连接oracle数据库的问题

    因电脑没有 安装oracle服务器端,所以安装plsql后还是不能连接oracle数据库,网上下载一个oracle客户端工具,是绿色免安装的,解压就好.我放我云盘了. instantclient_11 ...

  7. hdu_5903_Square Distance(dp)

    题目链接:hdu_5903_Square Distance 题意: 给你一个长度为n的a串,一个数m,现在让你构造一个长度也为n的b串,使这个串是由两个相同的串拼起来的,并且和a串对应的位不同的数量为 ...

  8. ubuntu 操作系统相关操作

    查看操作系统位数 命令:  getconf LONG_BIT root@hbg:/# getconf LONG_BIT 64 查看操作系统信息 命令: lsb_release -a root@hbg: ...

  9. Apache Zeppelin

    介绍 用于做数据分析和可视化 一.二进制安装 1)下载二进制包 wget http://mirrors.tuna.tsinghua.edu.cn/apache/incubator/zeppelin/0 ...

  10. UVA 562 Dividing coins (01背包)

    //平分硬币问题 //对sum/2进行01背包,sum-2*dp[sum/2] #include <iostream> #include <cstring> #include ...