A - Integer Sum Editorial by en_translator

If you are new to learning programming and do not know where to start, please try Problem A “Welcome to AtCoder” from practice contest. There you can find a sample code for each language.
Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in “AtCoder Beginners Selection” (
「競プロ典型 90 問」(Typical 90 Problems of Competitive Programming) ( is a collection of typical 90 competitive programming problems; unfortunately, currently the problem statements are all Japanese.
「C++入門 AtCoder Programming Guide for beginners (APG4b)」( is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.

Solution in C++

First, receive the input \(N\).

int N;
cin >> N;

Next, create an array of \(N\) values.

vector<int> A(N);

Then, receive the input as follows.

for(int i = 0; i < N; i++){
  cin >> A[i];

Finally, find the sum of the \(N\) integers and print it.

int sum = 0;
for(int i = 0; i < N; i++){
  sum += A[i];
cout << sum << endl;

Sample code

Solution in Python

First, receive the input \(N\).

N = int(input())

Then, create an array consisting of \(N\) values to receive the input.

A = list(map(int, input().split()))

Finally, find the sum of the \(N\) integers and print it.

Sum = 0
for i in range(N):
  Sum += A[i]

Sample code

last update: