//poj3619 读书时间 = 专注 +休息 读完n页书需要多久
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int n, k;
int s, t, r;
cin>>n>>k;
for(int i = 0; i < k; i++)
{
cin>>s>>t>>r;
int j = 1;
int result = 0;
while(s * t * j < n)
{
result += (t + r);
j++;
}
int diff = n - s * t *(j - 1);
int addMin;
if(diff % s == 0)
addMin = diff / s;
else
addMin = diff /s + 1;
result += addMin;
cout<<result<<endl;
}
return 0;
}
poj3619
最新推荐文章于 2021-02-07 10:33:20 发布