Codeforces Round #441 (Div. 2)
codeforces 876 A. Trip For Meal(水题)
题意:R、O、E三点互连,给出任意两点间距离,你在R点,每次只能去相邻点,要走过n个点,求走过的最短距离。
1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 int main() { 6 int n, a, b, c; 7 scanf("%d%d%d%d", &n, &a, &b, &c); 8 if(n==1) puts("0"); 9 else printf("%d\n", (n-2) * min(a, min(b,c)) + min(a,b)); 10 return 0; 11 }