【题解】A-购物(7612. 2020牛客NOIP赛前集训营-普及组(第五场))
T1 购物
https://ac.nowcoder.com/acm/contest/7612/A
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;
}
莉莉丝游戏公司福利 699人发布