快读快写【模板】

· · 算法·理论

int read(){
    int sum=0,a=1;
    char c=getchar();
    while(c<'0' || c>'9'){
        if(c=='-'){
            a=-1;
        }
        c=getchar();
    }
    while(c>='0' && c<='9'){
        sum=sum*10+c-'0';
        c=getchar();
    }
    return sum*a;
}
void write(int a){
    if(a<0){
        a*=-1;
        putchar('-');
    }
    if(a>9)
        write(a/10);
    putchar(a%10+'0');
}