POJ3619

来源:互联网 发布:nginx 打印php的错误 编辑:程序博客网 时间:2024/04/27 15:05

题意:  给N 页书,K个人    S 每个人一分钟阅读页数,一次阅读T分钟,得休息R分钟后才继续阅读

#include <iostream>#include <cstdio>#include <cmath>#include <algorithm>#include <cstring>using namespace std;int main(){    int s,t,r;    int n,k;    float tim,re;    scanf("%d%d",&n,&k);    while(k--)    {        scanf("%d%d%d",&s,&t,&r);        tim=n/s;        if(n%s!=0)        {            tim++;           //判断一共需要多少阅读分钟,然后接下来找出休息间隔。        }        re=tim/t;         printf("%f\n",re);        if(re-floor(re)==0)      // floor 返回不大于RE的最大整数,得double 或者float型。注意负数向负方向返回值        {            re--;            printf("%f\n",re);        }        printf("%d\n",(int)tim+(int)re*r);         }}