/* -*- coding: utf-8 -*- * * 3165.cc: No.3165 [Cherry 7th Tune A] Croissants Continu - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 300000; /* typedef */ using ll = long long; /* global variables */ int as[MAX_N]; /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i); ll s = 0; for (int i = 0; i < n; i++) s += as[i]; int maxa = *max_element(as, as + n); if (maxa * 2 > s) s = (s - maxa) * 2 + 1; printf("%lld\n", s); } return 0; }