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 |
因为scanf 读入失败的时候返回值是 -1 直接拿来判断当然会死循环 另外 EOF == -1In Reply To:为什么用while(scanf("%d",&n))就TLE,而用while(scanf("%d",&n)!=EOF)就AC呢 Posted by:whu_zhengxinle at 2012-02-06 21:49:18 因为scanf 读入失败的时候返回值是 -1 直接拿来判断当然会死循环 另外 EOF == -1 一般是写成 while(~scanf(**)) 的形式的 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator