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