题目连接: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. namenode无法启动

    查看日志错误信息关键语句: There appears to be a gap in the edit log.  We expected txid 44353, but got txid 原因: n ...

  2. SVN常用命令积累

      一.SVN SW (repo 重定向) 服务器的IP地址或者URL变更,版本库服务器的IP也要修改,因为当初安装SVN URL没有使用别名,所以使用的人都要修改客户端的IP. 1.Windows ...

  3. 《JavaScript高级程序设计》读书笔记 ---Array 类型

    除了Object 之外,Array 类型恐怕是ECMAScript 中最常用的类型了.而且,ECMAScript 中的数组与其他多数语言中的数组有着相当大的区别.虽然ECMAScript 数组与其他语 ...

  4. 判断是否点击键盘enter键

    //enter键监测触发事件 function checkKeyCode() { document.onkeydown = function(e) { if(!e) e = window.event; ...

  5. iframe自适应高度计算,iframe自适应

    计算页面的实际高度,iframe自适应会用到 IfrHeight: function (iframeId, callback) { var height; function calcPageHeigh ...

  6. CodeForces 696C PLEASE

    快速幂,费马小定理,逆元. 设$dp[n]$表示$n$次操作之后的概率,那么$dp[n] = \frac{{(1 - dp[n - 1])}}{2}$.$1-dp[n - 1]$表示上一次没有在中间的 ...

  7. hdu1022

    #include <stdio.h>#include <string.h> int main(void){ int n,i,j,k,l; char o1[10],o2[10], ...

  8. jQuery第五章

    jQuery对表单.表格的操作以及更多应用 一.表单应用 1.单行文本框应用 (1)获取和失去焦点改变样式 HTML代码如下: <form action="#" method ...

  9. js 上传图片预览

    <script language='javascript'> function show(){ var p=document.getElementById("file1" ...

  10. MongoDB数据模型(二)

    原文地址 接上一篇 四.模型树结构 父引用的模型树结构 这个数据模型描述了一个树形结构,在子节点中存储父节点的引用. 模式 父引用模式存储每个树节点到文档中,除了树节点外,文档还存储了父节点的id. ...