TLE #16,其余AC,求助!
查看原帖
TLE #16,其余AC,求助!
941490
SeriousFairy楼主2025/7/25 22:08
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,x,ans;
inline int read()
{
	int t=1,x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')
		{
			t=-1;
		}
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*t;
}
inline void write(int x)
{
    if(x<0)
	{
		putchar('-');
		x=-x;
	}
    if(x<10)
	{
		putchar(x+'0');
	}
    else 
	{
		write(x/10);
		putchar(x%10+'0');
	}
}
signed main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		x=read();
		ans+=x;
	}
	write(ans);
	return 0;
}
2025/7/25 22:08
加载中...