| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:找了个读入优化,T了,scanf就A了In Reply To:找了个读入优化,T了,scanf就A了 Posted by:justryit at 2013-08-06 14:28:06 判断太多了……我习惯这么写
inline int getint()
{
int ans(0); char w = getchar();
while(w < '0' || '9' < w)w = getchar();
while('0' <= w && w <= '9')
{
ans = ans * 10 + w - '0';
w = getchar();
}
return ans;
}
确实比scanf快一些,仅供参考
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator