Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- #include <algorithm>
- #include <vector>
- #include <algorithm>
- #include <set>
- #include <cstring>
- #include <cmath>
- #include <map>
- #include <fstream>
- using namespace std;
- int n;
- int arr[505];
- int f(int i) {
- if(i == n) {
- return 0;
- }
- return f(i + 1) + arr[i];
- }
- int main() {
- cin >> n;
- for(int i = 0; i < n; i++) {
- cin >> arr[i];
- }
- cout << f(0) << endl;
- return 0;
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement