Sum of array elements#8763

Sum of array elements

1 second
128 megabytes
Easy

Given array of length . Find the sum of its elements.

Implement the function:

long long solve(int n, vector <int> arr); // C++

function solve(const n :integer; const arr: array of integer) : integer; // Pascal

public static int solve(int n, int []arr); // Java

def solve(n, arr); // Python

static long solve(long n, long [] arr); // C#

Input

First line contains number of elements (1 \leq n \leq 10^5) in array.

Second line contains integers a_1, a_2, ..., a_n (1 \leq a_i \leq 10^6) - the array elements.

Output

One integer will be printed - the sum of array elements.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Scoring

  1. ( points) n \leq 1;

  2. ( points) n \leq 100, a_i \leq 100;

  3. ( points) n \leq 10^4, a_i \leq 10^4;

  4. ( points) without additional restrictions.