fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int d;
  8. int n;
  9. int k;
  10. int suma;
  11. cin >> d;
  12. while ( d > 0 )
  13. {cin >> n;
  14. suma=0;
  15.  
  16. while ( n > 0)
  17. {
  18. cin >> k;
  19. suma = suma + k;
  20. n --;
  21.  
  22. }
  23. cout << suma <<"\n";
  24. d --;
  25. }
  26.  
  27.  
  28. }
Success #stdin #stdout 0s 3300KB
stdin
2
5 1 2 3 2 1
3 2 1 98
stdout
9
101