fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. long int t;
  5.  
  6. int main()
  7. {
  8. cin>>t;
  9. for(int i=0; i<t; i++)
  10. {
  11. long int n,a;
  12. cin>>n;
  13. long int wiek=0,suma=0;
  14. for(int i=0; i<n; i++)
  15. {
  16. cin>>a;
  17. suma+=a;
  18. }
  19. if(n==1) wiek=a;
  20. else wiek=n/2+suma+1;
  21. cout<<wiek<<endl;
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0s 4524KB
stdin
3
1
0
1
5
4
0
0
0
0
stdout
0
5
3