Description
胡八一和王胖子发现了一个墓穴决定去摸金,按照祖上传下的规矩,在摸金的时候要在墓穴口放上蜡烛,摸金的时候若是蜡烛全灭了就要把宝物放还墓主人,然而贪心的王胖子决定多放点蜡烛,墓主人的鬼魂宅在墓中上千年不运动表示肺活量不够,吹灭一根蜡烛需要x秒,设宝物有y件,胡八一每摸一个宝物需要z秒,贪心的王胖子需要你的帮助算一下需要放多少蜡烛才能在所有蜡烛熄灭前盗贼所有宝物?
Input
有t组数据.
每组数据一行,每行包含3个整数,x,y,z(0<=y<=1000,0<x,z<=1000)
Output
每组数据输出需要蜡烛的数量
Sample Input
22 1 11 1 1
Sample Output
12
解题报告:考虑y等于0的情况
code:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<stack>
#include<cmath>
#include<string>
#include<cstring>
#include<ctype.h>
using namespace std;
typedef long long ll;
int main()
{
freopen("input.txt","r",stdin);
int t;
int x,y,z;
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&x,&y,&z);
if(y==0){
printf("0\n");
}else{
printf("%d\n",y*z/x+1);
}
}
return 0;
}