poj3619

水题,注意判断是不是整分钟读完,如果不是,去尾进一。

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

int n, k;

void work()
{
	int s, t, r;
	scanf("%d%d%d", &s, &t, &r);
	int time = n / (s * t) *(t + r);
	int left = n % (s * t);
	if (left == 0)
	{
		printf("%d\n", time - r);
		return;
	}
	if (left % s == 0)
		time += left / s;
	else
		time += left / s + 1;
	printf("%d\n", time);
}

int main()
{
	//freopen("D:\\t.txt", "r", stdin);
	scanf("%d%d", &n, &k);
	for (int i = 0; i < k; i++)
		work();
	return 0;
}
原文地址:https://www.cnblogs.com/rainydays/p/1948659.html