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