专栏文章

快读快写模板

算法·理论参与者 1已保存评论 0

文章操作

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

当前评论
0 条
当前快照
1 份
快照标识符
@mioxq9c4
此快照首次捕获于
2025/12/03 02:52
3 个月前
此快照最后确认于
2025/12/03 02:52
3 个月前
查看原文
快读1:
CPP
#include<bits/stdc++.h>
#define int long long
using namespace std;
int t;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		cout<<n<<"\n";
	}
	
	
	
	
	
	
	return 0;
}
快读2:
CPP
#include<bits/stdc++.h>
#define int long long
using namespace std;
int t;
signed main(){
	scanf("%lld",&t);
	while(t--){
		int n;
		scanf("%lld",&n);
		printf("%lld\n",n);
	}
	
	
	
	
	return 0;
} 
快读3:
CPP
#include<bits/stdc++.h>
#define int long long
using namespace std;
int t;
template<typename T>inline void read(T&x){
	x=0;
	char c;
	int sign=1;
	do{
		c=getchar();
		if(c=='-'){
			sign=-1;
		}
	}while(!isdigit(c));
	do{
		x=x*10+c-'0';
		c=getchar();
	}while(isdigit(c));
	x*=sign;
}
inline void write(int x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
signed main(){
	read(t);
	while(t--){
		int n;
		read(n);
		write(n);
	}
	
	
	
	
	return 0;
} 
快读4(字符串):
CPP
#include<bits/stdc++.h>
using namespace std;
inline string readstr(){
	string str="";
	char ch=getchar();
	while(ch=='\n'||ch=='\r'){
		ch=getchar();
	}
	while(ch!='\n'&&ch!='\r'){
		str+=ch;
		ch=getchar();
	}
	return str;
}
inline void writestr(string s){
	for(int i=0;s[i]!='\0';i++){
		putchar(s[i]);
	}
}
string s;
signed main(){
	s=readstr();
	writestr(s);
	
	
	
	
	
	return 0;
}
快读5(最快):
CPP
#include<bits/stdc++.h>
using namespace std;
namespace FastIO{
	const int SZ=1<<20;
	char inbuf[SZ],outbuf[SZ];
	int in_left=0,in_right=0;
	int out_right=0;
	inline void load(){
		int len=fread(inbuf,1,SZ,stdin);
		in_left=0;
		in_right=len;
	}
	inline char getchar(){
		if(in_left>=in_right){
			load();
		}
		if(in_left>=in_right){
			return EOF;
		}
		return inbuf[in_left++];
	}
	inline int read(){
		int x=0,f=1;
		char ch=getchar();
		while(ch<'0'||ch>'9'){
			if(ch=='-'){
				f=-1;
			}
			ch=getchar();
		}
		while(ch>='0'&&ch<='9'){
			x=x*10+(ch-'0');
			ch=getchar();
		}
		return x*f;
	}
	inline void flush(){
		fwrite(outbuf,1,out_right,stdout);
		out_right=0;
	}
	inline void putchar(char ch){
		outbuf[out_right++]=ch;
		if(out_right==SZ){
			flush();
		}
	}
	inline void write(int x){
		if(x<0){
			putchar('-');
			x=-x;
		}
		if(x>9){
			write(x/10);
		}
		putchar(x%10+'0');
	}
	struct Flusher{
		~Flusher(){
			flush();
		}
	}flusher;
}
using FastIO::read;
using FastIO::write;
using FastIO::putchar;
signed main(){
	int n=read();
	while(n--){
		int op=read();
		write(op);
		putchar('\n');
	}
	
	//使用命名空间版本 
	
	int m=FastIO::read();
	while(m--){
		int po=FastIO::read();
		FastIO::write(po);
		FastIO::putchar('\n');
	}
	
	
	return 0;
}

评论

0 条评论,欢迎与作者交流。

正在加载评论...