fork(2) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int t;
  8. cin>>t;
  9. for(int i=1; i<=t; i++)
  10. {
  11. int t2;
  12. cin>>t2;
  13. int liczby[t2];
  14. int suma=0;
  15. for(int j=0; j<t2; j++)
  16. {
  17. cin>>liczby[j];
  18. suma+=liczby[j];
  19. }
  20. cout<<suma<<endl;
  21. }
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 3416KB
stdin
2
5
1 2 3 4 5
2
-100 100
stdout
15
0