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:答案不正确为啥???帮忙指教一下In Reply To:答案不正确为啥???帮忙指教一下 Posted by:04408118 at 2010-08-13 19:43:32 #include <iostream> using namespace std; double length[300]; int main() { memset(length,0,sizeof(length)); int i; double len; while(cin>>len) { if(len==0) break; for(i=1;i<300;i++) { if(length[i]==0) length[i]=length[i-1]+1.0/(i+1); if(length[i]>=len) { cout<<i<<' '<<"card(s)"<<endl; break; } } } return 0; } 我的,,请不要那样输入数据,你那样是一次输完,,然后再输出结果,,实际要求是输入一个数据出一个结果,,具体参见1001的说明,,, Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator