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

Re:我想知道最快的方法是啥?

Posted by mogen at 2010-04-12 20:55:19 on Problem 1003
In Reply To:我想知道最快的方法是啥? Posted by:xjtudamajia at 2009-11-24 19:25:09
> 在java做的结果里面看到好多用十几MS甚至0MS做到的~谁能告诉我怎么做的?
#include<iostream>
#include "math.h"
#include <vector>
using namespace std;
using std::vector;

int main()
{
	vector<double> v;
	double x;
	int n;
	const double r=0.577218;
	while(cin>>x)
	{
		if(x!=0.0)
		 v.push_back(x);
		else
			break;
	}
	for(vector<double>::iterator it=v.begin();it!=v.end();it++)
	{
	    double l=exp(*it+1-r)-1;
		n=(int)(l+0.5);
		cout<<n<<" 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