查看原帖
1051310
wang6w6楼主2024/9/20 09:31

OLE,MLE,TLE,我都有了,崩溃了

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,p;
ll rd(){
	ll f=1,x=0;
	char c=getchar_unlocked();
	while(c<'0'||c>'9'){
		if(c=='-') f=-1;
		c=getchar_unlocked();
	}
	while(c>='0'&&c<='9'){
		x=x*10+c-'0';
		c=getchar_unlocked();
	}
	return f*x;
}
ll out(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	if(x>=10){
		out(x/10);
		putchar(x%10+'0');
	}else{
		putchar(x+'0');
	}
}
int main() {
	n=rd(),p=0;
	while(n--) {
		p+=rd();
	}
//	cout<<p;
	out(p);
	return 0;
}
2024/9/20 09:31
加载中...