速く読んで速く負ける

2262 ワード

templatevoid read(T &x)
{
    x=0;int f=1;char c=getchar();
    while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    x*=f;
}
templatevoid print(T x)
{
    if(x<0)putchar('-'),x=-x;
    if(x>9)print(x/10);
    putchar(x%10+48);
}

int型、long long型を読み込むことができます.
転載先:https://www.cnblogs.com/719666a/p/10334126.html