Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

怎么是 Time Limit Exceeded

Posted by 969396452 at 2009-11-26 20:34:19 on Problem 1003
#include<iostream>
#include<vector>
using namespace std;
int main()
{  vector<float> dvec;
   float test_case,sum=0.00;
   cin>>test_case;
   while(test_case!=0.00)
   {dvec.push_back(test_case);
    cin>>test_case;
   }
   int card_number;
   	 
   vector<float>::iterator iter;
  
   for(iter=dvec.begin();iter!=dvec.end();++iter)
   {  card_number=1;
     
      while(1)
	  {  
		sum=sum+(float)1/(card_number+1);
       
	    
      bool  sings=(int)*iter==(int)sum;
		if(sings)break;
		++card_number;
		
     }
     cout<<card_number<<" card(s)"<<endl;
   }
 
   return 0; 
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator