社区讨论

求优化

P1001A+B Problem参与者 3已保存回复 3

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
3 条
当前快照
1 份
快照标识符
@mhj1kqtg
此快照首次捕获于
2025/11/03 19:13
4 个月前
此快照最后确认于
2025/11/03 19:13
4 个月前
查看原帖
CPP
#include<bits/stdc++.h>
using namespace std;

typedef int fast_io_type;


inline void fast_read(fast_io_type & value){
	value = 0;
	bool negative = false;
	char ch = getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch = getchar();
	if(ch=='-'){negative=true;ch=getchar();}
	while(ch>='0'&&ch<='9'){value=(value<<1)+(value<<3)+(ch^'0');ch = getchar();}
	if(negative) value = ~value+1;
}


inline void fast_write(fast_io_type value){
	if(value==0){putchar('0');return;}
	if(value<0){putchar('-');value = ~value+1;}
	char str[20];
	int lengh = 0;
	while(value!=0){str[lengh++]='0'+value%10;value/=10;}
	for(int i = lengh-1;i>=0;i--) putchar(str[i]);
}


int main(){
	int a , b;
	fast_read(a);
	fast_read(b);
	fast_write(a+b);
	
	return 0;
}

慢死了 似乎还没有scanf快
求 Fast IO

回复

3 条回复,欢迎继续交流。

正在加载回复...