A-购物
思路
签到题,模拟即可。
代码
#include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
int n, k, x, ans = 0;
cin >> n >> k >> x;
int i = 0, j = 0;
while(i < n) {
i++;
j++;
ans += x;
if(j == k) {
j = 0;
i++;
}
}
cout << ans << endl;
}
return 0;
} 
京公网安备 11010502036488号