http://blog.csdn.net/shahdza/article/details/6317011
inline void in(int &ret){ char c; ret=0; while(c=getchar(),c<‘0‘||c>‘9‘); while(c>=‘0‘&&c<=‘9‘) ret=ret*10+(c-‘0‘),c=getchar(); }
inline bool in(int &ret){ char c; int sgn; while(c=getchar(),c!=‘-‘&&(c<‘0‘||c>‘9‘)) if(c==EOF) return 0; sgn=(c==‘-‘)?-1:1; ret=(c==‘-‘)?0:(c-‘0‘); while(c=getchar(),c>=‘0‘&&c<=‘9‘) ret=ret*10+(c-‘0‘); ret*=sgn; return 1; }
inline bool in(double &ret){ char c; int sgn; double bit=0.1; while(c=getchar(),(c<‘0‘||c>‘9‘)&&c!=‘-‘&&c!=‘.‘) if(c==EOF) return 0; sgn=(c==‘-‘)?-1:1; ret=(c==‘-‘)?0:(c-‘0‘); while(c=getchar(),c>=‘0‘&&c<=‘9‘) ret=ret*10+(c-‘0‘); if(c!=‘.‘){ ret*=sgn; return 1; } while(c=getchar(),c>=‘0‘&&c<=‘9‘) ret+=(c-‘0‘)*bit,bit/=10; ret*=sgn; return 1; }
void out(int x){ if(x<0){ putchar(‘-‘); out(-x); return; } if(x>9) out(x/10); putchar(x%10+‘0‘); }
时间: 2024-10-10 12:33:39