poj 3619(水题,ceil函数)

#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
    double n,k,s,t,r,s1,sum,turn,ans;
    scanf("%lf%lf",&n,&k);
    while(k--){
        scanf("%lf%lf%lf",&s,&t,&r);
        double sum = n/s;
        ans = 0;
        while(sum>t){
            ans += t+r;
            sum -= t;
        }
        ans += sum;
        printf("%.0lf\n",ceil((double)ans));;
    }
    return 0;
}

 

posted @ 2021-08-01 21:37  智人心  阅读(25)  评论(0)    收藏  举报