题目连接: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. ionic 进入多级目录以后隐藏底部导航栏(tabs)(完美解决方案)

    公司开始使用ionic开发项目,在此记录下把遇到的问题,网上有大牛已经把解决方法整出来了,不过记录在自己这里方便查阅. 这篇记录在有tabs的项目里,进入子层级时,底部导航还一直存在,本人是要让他只在 ...

  2. 滚动动画animate-scroll扩展

    原动画库地址:animate-scroll 扩展动画库下载地址:animate-scroll-ext 由于项目需要,对animate-scroll进行扩展,扩展后修改或增加了以下几点: 对原动画库进行 ...

  3. Angular DirtyChecking(脏值检查) $watch, $apply, $digest

    Dirty Checking (脏值检查) Digest cycle and $scope Digest cycle and $scope First and foremost, AngularJS ...

  4. 常用的js事件

    onmouseover:鼠标放上去时触发事件 onmouseout:鼠标从上面移开时触发事件 onclick:鼠标单击事件 onfocus:获得焦点 onblur:失去焦点 onchange:下拉菜单 ...

  5. redis 2

    http://www.infoq.com/cn/articles/tq-redis-memory-usage-optimization-storage 在Ubuntu下安装reids redis-2. ...

  6. SpringMVC通过注解获得参数

    SpringMVC可以通过RequestParam注解来映射获得参数,具体用法如下: 例子: 配置过程省略 1.新建controller类 package com.loger.controller; ...

  7. 2017-1-15-libubox analysis

    2017-1-15-libubox analysis libubox utils.h utils.h 提供了一些简单的实用工具函数.比如大小端转换,位图操作,编译器属性的封装,连续内存申请函数call ...

  8. Html网页的代码

    Html网页的代码 很全哦 1)贴图:<img src="图片地址"> 2)加入连接:<a href="所要连接的相关地址">写上你想写 ...

  9. 关于requirejs中的define的原理理解

    我们已经了解到模块模式是为单例创建私有变量和特权方法的. 一个最基本的例子: var foo=(function(){ var something='cool', var another=[1,2,3 ...

  10. jquery 画板折叠

    <!doctype html><html lang="en"><head> <meta charset="utf-8" ...