#Lutece2353. Cooking
Cooking
Migrated from Lutece 2353 Cooking
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Potter needs to cook pieces of beef. Cooking a piece of beef needs steps and each step takes minutes. It's not necessary to cook a piece of beef continueously, which means after finishing one step, he can set the beef aside and cook another one. Potter is a skilled cook that he can deal with at most different pieces of beef at the same time.
Potter want to finish it as soon as possible. Please help him calculate how long will it take to finish cooking ?
Input
Output
An integer , indicating that Potter has to spend at least minutes on cooking.
Samples
3 2 2 3
9
Constraints
Note
n=3 m=2 k=2 t=3
At the beginning : (0,0,0)
3min to deal with the first and the second : (1,1,0)
3min to deal with the first and the third : (2,1,1)
3min to deal with the second and the third : (2,2,2)
It takes 9 min totally.
Resources
电子科技大学第十届ACM趣味程序设计竞赛