poj3619

来源:互联网 发布:软件界面开发工具 编辑:程序博客网 时间:2024/05/02 00:44
//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;elseaddMin = diff /s + 1;result += addMin;cout<<result<<endl;  }return 0;}

0 0
原创粉丝点击