2014年百度之星程序设计大赛 - 资格赛 第一题 Energy Conversion
2024-08-31 02:00:16
小记:long long %I64d
代码:
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm> using namespace std; #define mst(a,b) memset(a,b,sizeof(a))
#define eps 10e-8 const int MAX_ = 10010;
const int N = 100010;
const int INF = 0x7fffffff; int main(){
long long T, n, m, v, k, pre, cnt;
scanf("%I64d", &T);
while(T--){
scanf("%I64d%I64d%I64d%I64d", &n, &m, &v, &k);
cnt = 0;
while(m > -1 && m < n){
pre = m;
m = (m - v) * k;
cnt++;
if(m <= pre)m = -1;
}
if(m < 0){
cnt = -1;
}
printf("%I64d\n", cnt);
}
return 0;
}
最新文章
- git diff
- 【iCore3 双核心板】例程五:SYSTICK定时器实验——定时点亮LED
- Qrels supervision information以及document collection,如何划分为train、test,保证test中doc对于train来说是new document
- MySQL中varchar类型在5.0.3后的变化
- 基于TCP协议的网络通信
- Ubuntu CTRL+ALT+F1~F6 进入命令模式后不支持中文显示的解决办法
- RxJava开发精要7 – Schedulers-解决Android主线程问题
- 使用UIBezierPath和CAShapeLayer画各种图形
- select省市联动选择城市 asp.net mvc4
- Date时间对象方法
- 面试(2)-java-se-HashSet和TreeSet
- Andrew Ng机器学习课程笔记--week10(优化梯度下降)
- defer 和 async 区别
- linux VIM 下的语法高亮及自动缩进
- svn的使用教程
- How to resize or create a thumbnail image from file stream on UWP
- hdu 4432 第37届ACM/ICPC天津现场赛B题
- 理解 process.initgroups(user, extra_group)
- PYTHON如何降级?
- Thread类的常见问题