Competitive Programming Solutions

GitHub
back to dashboard

M. Suffix Sum

Codeforces - Sheet #7 (Recursion) · limit: 1s · memory: 256MB · view on codeforces

input

5 3
1 8 2 10 3

output

15
Main.java
static void solve() {

        // Write your solution here
        int n = in.nextInt();
        int m = in.nextInt();

        int[] a = readIntArray(n);
        out.println(sum(a, m, n - 1));

    }