代码
#include<cstdio>
#define num int
num read(){
num a=0;
int isneg=1;
char c=getchar_unlocked();
//getchar_unlock()只能在linux系统用,注意一下,不能就改成getchar()
while(c<'0'||c>'9'){
if(c=='-')isneg=-1;
c=getchar_unlocked();
}
while(c<='9'&&c>='0'){
a=a*10+c-'0';
c=getchar_unlocked();
}
return a*isneg ;
}
void out(num x){
if(x<0)putchar('-'),x=-x;
if(x<10)putchar(x+'0');
else out(x/10),putchar(x%10+'0');
}
int main(){
int n=read();
int sum=0;
int temp;
while(n--){sum+=read();}
out(sum);
return 0;
}