304599: CF876A. Trip For Meal
Memory Limit:512 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Trip For Meal
题意翻译
小熊维尼非常喜欢蜂蜜! 所以他决定去拜访他的朋友。 小熊有三个最好的朋友:兔子,猫头鹰和小毛驴,每个人都住在自己的房子里。 每对房屋之间都有蜿蜒的小路。 兔子和猫头鹰的房子之间的路径长度是a米,兔子和小毛驴的房子之间的距离是b米,猫头鹰的和小毛驴的房子之间的距离是c米。 为了享受圣诞节,维尼想要每天吃n餐饭。 每次维尼都会把每家的蜂蜜都吃完后再离开。 当维尼没有吃满n次时,他会去离他最近的下一家继续吃。 当维尼在一个人家吃饭时,其他人家会重新买来新蜂蜜。 已知现在维尼在兔子家吃的一餐,求维尼要吃满n餐最少要走的路。 第一行包含整数n(1 <= n <= 100 1 <= n <= 100) - 想吃的餐数。 第二行包含一个整数a(1 <= a <= 100 1 <= a <= 100) - 兔子和猫头鹰的房子之间的距离。 第三行包含一个整数b b(1 <= b <= 100 1 <= b <= 100) - 兔子和小毛驴家的距离。 第四行包含一个整数c(1 <= c <= 100 1 <= c <= 100) - 猫头鹰和小毛驴的房子之间的距离。 感谢@Jianuo_Zhu 提供的翻译题目描述
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are winding paths between each pair of houses. The length of a path between Rabbit's and Owl's houses is $ a $ meters, between Rabbit's and Eeyore's house is $ b $ meters, between Owl's and Eeyore's house is $ c $ meters. For enjoying his life and singing merry songs Winnie-the-Pooh should have a meal $ n $ times a day. Now he is in the Rabbit's house and has a meal for the first time. Each time when in the friend's house where Winnie is now the supply of honey is about to end, Winnie leaves that house. If Winnie has not had a meal the required amount of times, he comes out from the house and goes to someone else of his two friends. For this he chooses one of two adjacent paths, arrives to the house on the other end and visits his friend. You may assume that when Winnie is eating in one of his friend's house, the supply of honey in other friend's houses recover (most probably, they go to the supply store). Winnie-the-Pooh does not like physical activity. He wants to have a meal $ n $ times, traveling minimum possible distance. Help him to find this distance.输入输出格式
输入格式
First line contains an integer $ n $ ( $ 1<=n<=100 $ ) — number of visits. Second line contains an integer $ a $ ( $ 1<=a<=100 $ ) — distance between Rabbit's and Owl's houses. Third line contains an integer $ b $ ( $ 1<=b<=100 $ ) — distance between Rabbit's and Eeyore's houses. Fourth line contains an integer $ c $ ( $ 1<=c<=100 $ ) — distance between Owl's and Eeyore's houses.
输出格式
Output one number — minimum distance in meters Winnie must go through to have a meal $ n $ times.
输入输出样例
输入样例 #1
3
2
3
1
输出样例 #1
3
输入样例 #2
1
2
3
5
输出样例 #2
0