Quckly读入+输出
Quckly读
onecode IDE 中可以运行的快读
#include<ctype.h>
#include<iostream>
#include<stdio.h>
#define TP long long
#define Max 100009
using namespace std;
TP read(){
char c=getchar();
TP x=0;
bool f=0;
while(!isdigit(c))f^=!(c^45),c=getchar();
while(isdigit(c))x=(x<<1)+(x<<3)+(c^48),c=getchar();
if(f)x=-x;return x;
}
int main(){
return 0;
}
onecode IDE 中可以运行的头文件
#include<ctype.h>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<iomanip>
#include<ios>
#include<iostream>
#include<stdbool.h>
using namespace std;
int main(){
return 0;
}
输出
template<typename T>
inline void prints(T x){
if(x<10)putchar(x+48);
else{prints(x/10);putchar(x%10+48);}
}
template<typename T>
inline void print(T x,char c){
if(x<0)x=-x,putchar(45);
prints(x);putchar(c);
}
//输出格式为
//print(变量,'字符');
//e.g. print(n,10);或print(n,'\n');
精简
#include<bits/stdc++.h>
#define I int
#define L long long
#define C char
#define S string
#define B bool
#define Max 100000009
#define Mid 1000009
#define Sml 10009
#define Lit 109
using namespace std;
inline int read(){
char c=getchar();
int x=0;
bool f=0;
while(!isdigit(c))f^=!(c^45),c=getchar();
while(isdigit(c))x=(x<<1)+(x<<3)+(c^48),c=getchar();
if(f)x=-x;return x;
}
int main(){
return 0;
}
整数类型:
#include<bits/stdc++.h>
#define TP int
//快读的类型可切换为:
//long long
//long int
//long long int
//__int128
inline TP read(){
char c=getchar();
TP x=0;
bool f=0;
while(!isdigit(c))f^=!(c^45),c=getchar();
while(isdigit(c))x=(x<<1)+(x<<3)+(c^48),c=getchar();
if(f)x=-x;return x;
}
int main(){
return 0;
}
char数组类型:
#include<bits/stdc++.h>
inline bool blank(char c){return !(c&&c^9&&c^10&&c^13&&c^32);}
inline void readstr(char *s){
char c=getchar();
while(blank(c))c=getchar();
while(!blank(c))*s++=c,c=getchar();*s=0;
}
//char wlxsq[123]
int main(){
//readstr(wlxsq);
return 0;
}
double类型:
#include<bits/stdc++.h>
inline double readdouble(){
char c=getchar();
double x=0;
bool f=0;
while(!isdigit(c))f^=!(c^45),c=getchar();
while(isdigit(c))x=x*10+(c^48),c=getchar();
if(!(c^46)){
double t=1;c=getchar();
while(isdigit(c))t/=10,x+=t*(c^48),c=getchar();
}if(f)x=-x;return x;
}
int main(){
return 0;
}
整合
#include<bits/stdc++.h>
#define TP __int128
using namespace std;
inline TP read(){
char c=getchar();
TP x=0;
bool f=0;
while(!isdigit(c))f^=!(c^45),c=getchar();
while(isdigit(c))x=(x<<1)+(x<<3)+(c^48),c=getchar();
if(f)x=-x;return x;
}
inline double readdouble(){
char c=getchar();
double x=0;
bool f=0;
while(!isdigit(c))f^=!(c^45),c=getchar();
while(isdigit(c))x=x*10+(c^48),c=getchar();
if(!(c^46)){
double t=1;c=getchar();
while(isdigit(c))t/=10,x+=t*(c^48),c=getchar();
}if(f)x=-x;return x;
}
inline bool blank(char c){return !(c&&c^9&&c^10&&c^13&&c^32);}
inline void readstr(char *s){
char c=getchar();
while(blank(c))c=getchar();
while(!blank(c))*s++=c,c=getchar();*s=0;
}
inline bool isendl(char c){return !(c&&c^10&&c^13);}
inline void getstr(char *s){
char c=getchar();
while(isendl(c))c=getchar();
while(!isendl(c))*s++=c,c=getchar();*s=0;
}
template<typename T>
inline void prints(T x){
if(x<10)putchar(x+48);
else{prints(x/10);putchar(x%10+48);}
}
template<typename T>
inline void print(T x,char c){
if(x<0)x=-x,putchar(45);
prints(x);putchar(c);
}
int main(){
return 0;
}