//输入
template<class T>
inline void read(T&x)
{
T ans=0,f=1;
char ch=getchar();
while(ch>'9'||ch<'0')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch<='9'&&ch>='0')
{
ans=ans*10+ch-'0';
ch=getchar();
}
x=ans*f;
}
//输出
template<class T>
inline void prin(T x)
{
if(x>9)prin(x/10);
putchar(x%10+'0');//无回车
}
来源:https://www.cnblogs.com/CharlieWade/p/11410770.html