为啥报错?
查看原帖
为啥报错?
1080250
littleFond楼主2024/9/10 18:06
#include<bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
int n,a,ans; 
inline void read(int &n){
	int k=0,f=1;
	char c=getchar_unlocked();
	while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar_unlocked();
    }while(c>='0'&&c<='9'){
    	k=k*10+c-'0';
		c=getchar_unlocked();
	}n=k*f;
}
inline void out(int n){
	if(n<0){
		putchar('-');
		n=-n;
	}if(n<10)putchar(n+'0');
    else out(n/10),putchar(n%10+'0');
}
signed main(){
	read(n);
	for(int i=0;i<n;i++){
		read(a);
		ans+=a;
	}out(ans);
	return 0;
}
2024/9/10 18:06
加载中...