情况有s*k>=n,最多炸鱼数为n
s*k<n,最多炸鱼数为s*k
将s*k转化为k个s相加,每次结果与n比较
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define endl '\n'
#define ll long long
ll s, k, n, res;
void solve() {
cin >> s >> k >> n;
ll mx = max(s, k);
ll mn = min(s, k);
res = 0;
while (mn--) {
res += mx;
if (res >= n) {
cout << n << endl;
return;
}
}
cout << res << endl;
return;
}
int main() {
int t; cin >> t;
while (t--) {
solve();
}
return 0;
}