/*
#include <stdio.h>
int memo[1000001][26]={};
int f(int i,int j)
{
if(memo[i][j]!=0)
{
return memo[i][j];
}
if(j==1)
{
return i;
}
else if(i==f)
{
return 1;
}
else if(i<j)
{
return 0;
}
return memo[i][j]=f(i-1,j-1)+f(i-1,j);
}
int main()
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d",f(a,b));
return 0;
}
c언어(완) -> c 자료구조 (스택, 큐, 정렬, 이분탐색, dfs/bfs)
python -> py자료구조 -> 프로젝트 제작
c++
-1 // 0 1 2 3 ...
*/
#include <stdio.h>
int stack[1001]={};
int top=-1; // 마지막 데이터의 위치
void push(int x)
{
top++;
stack[top]=x;
}
//void pop()
//{
// printf("%d ",stack[top]);
// top--;
//}
int pop()
{
return stack[top--];
}
int main()
{
int a,b,i,c=0;
scanf("%d",&a);
for(i=1 ; i<=a ; i++)
{
scanf("%d",&b);
push(b);
}
while(top!=-1) // 스택에 뭔가 있다면
{
c=c+pop();
}
printf("%d",c);
}