原文链接:https://blog.youkuaiyun.com/qq_41117236/article/details/99313279
【题解】
思路:考官最坏情况拿m来分配给n+1-k份卷子来卡你最小的n+1-k个复习时间段,那么最少可以需要m+1个小时分给你的最小的n+1-k个复习时间段,保证了至少有一份试卷不会被卡掉,剩下k-1个复习时间要保证大于等于你最小的n+1-k个复习时间段的最大值。最糟糕的情况是n+1-k个复习时间段尽可能平均的分配,所以剩下k-1个最小的情况是都为m+1尽可能分配给n+1-k个每一段的较大值。最后输出两段之和即可。
#include<iostream>
#include<iomanip>
#include<deque>
#include<map>
#include<cstring>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<vector>
#include<cmath>
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
ll n,m,k;
cin>>n>>m>>k;
if(n==k){
ll temp=n*(m+1);
cout<<temp<<endl;
continue;
}
ll temp=(m/(n-k+1)+1);
cout<<temp*(k-1)+m+1<<endl;
}
return 0;
}
/*
4
5 5 3
10 109 10
7 8 6
6 7 4
*/