# 12000: 【原2000】Sum of Sequence

### 题目描述

author: xjia 原OJ链接：https://acm.sjtu.edu.cn/OnlineJudge-old/problem/2000

## Description

Given a sequence of integers $$a_1, a_2, \dots, a_n$$, calculate the sum of the sequence $$a_1 + a_2 + \dots + a_n$$.

## Input Format

Line 1: A positive integer $$n, 1 \leq n \leq 10000$$

Line 2: A sequence of $$n$$ integers $$a_1, a_2, \dots, a_n, \forall 1 \leq i \leq n, -10000 \leq a_i \leq 10000$$

## Output Format

Line 1: An integer representing the sum of the sequence

## Sample Input

3
4 5 6


## Sample Output

15


## Limits

Time limit: 500ms, memory limit: 50000kb.

## ligongzzz's solution

#include "cstdio"
using namespace std;

int main() {
int num,n;
long long ans=0;
scanf("%d", &num);
for (int i = 0; i < num; i++) {
scanf("%d", &n);
ans += n;
}

printf("%lld", ans);
return 0;
}


## yyong119's solution

#include <cstdio>

int main() {

long long sum = 0;
int n; scanf("%d", &n);
for (int i = 0; i < n; ++i) {
int tmp; scanf("%d", &tmp);
sum += tmp;
}

printf("%lld", sum);
return 0;
}