您的位置:首页 > 其它

SRM585 div2

2013-07-28 11:48 204 查看
250: 题意:给你n个数,让你求这段数里有多少个单调递增序列

 

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

class TrafficCongestionDivTwo
{
public:
long long theMinCars(int);
};

long long TrafficCongestionDivTwo::theMinCars(int treeHeight)
{
long long ret = 0;
int n = treeHeight-1;
ret = (long long)pow((double)2,(double)n);
while(n-2>=0)
{
ret += (long long)pow((double)2,(double)n-2);
n = n - 2;
}
if(n!=0) ret++;
return ret;
}


View Code

  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: