poj 3619(水题)

#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int s,t,r,n,k,tmp,tmp2;
    scanf("%d%d",&n,&k);
    while(k--){
        scanf("%d%d%d",&s,&t,&r);
        tmp = n/s;
        if(tmp*s<n){
            tmp += 1;
        }
        tmp2 = tmp/t;
        if(tmp2*t==tmp){
            tmp2-=1;
        }
        tmp = tmp+r*tmp2;
        printf("%d\n",tmp);
    }
    return 0;
}

 

posted @ 2021-11-29 20:01  智人心  阅读(22)  评论(0)    收藏  举报