| ||||||||||
| 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: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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator