fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int move(vector<int> v, int i) {
  5. if (i == v.size()) {
  6. return 0;
  7. }
  8. return v[i] + move(v, i + 1);
  9. }
  10.  
  11. int main() {
  12. int t;
  13. cin >> t;
  14. for (int i = 1; i <= t; ++i) {
  15. int n;
  16. cin >> n;
  17. vector<int> v(n);
  18. for (int j = 0; j < n; ++j) {
  19. cin >> v[j];
  20. }
  21. int result = move(v, 0);
  22. cout << "Case " << i << ": " << result << "\n";
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty