aboutsummaryrefslogtreecommitdiff
path: root/c/las12uvas/480_cuantasPido.cpp
blob: 2b1ed0336d3de4c333471f5904d251959ce10a46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

using namespace std;

int main() {
	int cases;
	int grapes, bad, group;
	cin >> cases;
	for (int i = 0; i < cases; i++) {
		cin >> grapes;
		cin >> bad;
		cin >> group;
		//cout << "Grapes/group case " << i << ": " << grapes/group << endl;
		cout << (grapes/group)*bad + min(grapes%group, bad) << endl;
	}
}