Crazyharp

竖琴


  1. 1. 代码
  • Home
  • about
  •   

© 2025 Crazyharp

Theme Typography by Makito

Developed byCrazy_Harp

Proudly published with Hexo

快读快写

Posted at 2024-12-04 ACM 

本文共162字,阅读需要约1分钟

代码

#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;
}
Share 

 Previous post: 更新日志7 Next post: KMP与拓展KMP 

© 2025 Crazyharp

Theme Typography by Makito

Developed byCrazy_Harp

Proudly published with Hexo