You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
595 B
C++
23 lines
595 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 55;
|
|
int a1[N], a2[N], b[N], d[N];
|
|
int main()
|
|
{
|
|
int n;
|
|
scanf("%d", &n);
|
|
for (int i = 1; i < n; i++)
|
|
scanf("%d", a1 + i), a1[i] += a1[i - 1];
|
|
for (int i = 1; i < n; i++)
|
|
scanf("%d", a2 + i), a2[i] += a2[i - 1];
|
|
for (int i = 0; i < n; i++)
|
|
scanf("%d", b + i);
|
|
for (int i = 0; i < n; i++)
|
|
d[i] = a1[i] + b[i] + (a2[n - 1] - a2[i]);
|
|
sort(d, d + n);
|
|
printf("%d", d[0] + d[1]);
|
|
return 0;
|
|
}
|