标签:des style blog class code c
Time Limit: 2000/1000 MS
(Java/Others) Memory Limit: 32768/32768 K
(Java/Others)
Total Submission(s): 4278 Accepted
Submission(s): 1024
1 #include <iostream>
2 #include <stdio.h>
3 using namespace std;
4
5 int main()
6 {
7 long long n,m,v,k;
8 int T;
9 scanf("%d",&T);
10 while(T--){
11 scanf("%I64d%I64d%I64d%I64d",&n,&m,&v,&k);
12 int sum = 0;
13 if(m>=n) //不用转换就可以
14 printf("0\n");
15 else if((m-v)*k<=m) //一定不可以
16 printf("-1\n");
17 else{ //模拟转换过程,直到拥有足够的能量
18 while(m<n){
19 m = (m-v)*k;
20 sum++;
21 }
22 printf("%d\n",sum);
23 }
24 }
25 return 0;
26 }
2014百度之星资格赛 1001:Energy Conversion(水题,逻辑题),布布扣,bubuko.com
2014百度之星资格赛 1001:Energy Conversion(水题,逻辑题)
标签:des style blog class code c
原文地址:http://www.cnblogs.com/yym2013/p/3733182.html