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 }
30ms

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2021-10-29
  • 2021-11-28
  • 2021-06-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-13
  • 2021-09-29
  • 2021-09-16
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案