fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int T;
  6. cin >> T;
  7.  
  8. while (T--) {
  9. int N;
  10. cin >> N;
  11.  
  12. long long trai = 0, phai = 0;
  13.  
  14. for (int i = 0; i < N; i++) {
  15. int x;
  16. cin >> x;
  17.  
  18. if (i < N / 2)
  19. trai += x;
  20. else
  21. phai += x;
  22. }
  23.  
  24. cout << trai * phai << endl;
  25. }
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty