| ||||||||||
| 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 | |||||||||
BUG!内详!In Reply To:大家看看为什么time limit exceed?郁闷啊,搞不明白:( Posted by:OQO at 2005-12-30 02:43:40 你的源程序多输出了一些字符,要严格按照题目要求!
还有数据类型处理BUG!
> #include<iostream.h>
> void main()
> { int i=1;
> float sumout=0,sumin;
> cout<<"please input the lengh"<<endl;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
删除
> cin>>sumin;
> while(sumin!=0)
> {
> for(sumout=0,i=1;sumout<sumin;)
> {sumout+=float(1/(++i));
~~~~~~~~~~~~~~~~~~~~~~~
更改为sumout+=1/(float)(++i);
> }
> cout<<"the number of card is "<<i-1<<endl;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
更改为cout<<i-1<<" card(s)"<<endl;
> cin>>sumin;
> }
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator