HDOJ2045(环形染色问题)
2017-10-11 20:02
99 查看
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <math.h>
using namespace std;
__int64 a[55];
void cacu()
{
a[1] = 3;
a[2] = 6;
a[3] = 6;
for (int i = 4; i <= 50; i++) a[i] = a[i - 1] + a[i - 2] * 2;
}
int main()
{
int n;
cacu();
while (cin >> n)
{
cout << a
<< endl;
}
}
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <math.h>
using namespace std;
__int64 a[55];
void cacu()
{
a[1] = 3;
a[2] = 6;
a[3] = 6;
for (int i = 4; i <= 50; i++) a[i] = a[i - 1] + a[i - 2] * 2;
}
int main()
{
int n;
cacu();
while (cin >> n)
{
cout << a
<< endl;
}
}
相关文章推荐
- HDOJ 4751 黑白染色问题
- 湖南大学ACM程序设计新生杯大赛 - Yuanyuan Long and His Ballons(环形染色问题)
- hdoj 2203 亲和串(字符串处理问题(strstr函数的巧用))
- HDOJ 3790最短路径问题
- HDOJ1876 DP问题
- hdoj 两车追及或相遇问题 1275 (数学)
- 【洛谷1330】封锁阳光大学 染色问题
- HDOJ 2553 N皇后问题
- HDOJ-----1573---X问题(扩展欧几里得)
- HDOJ N皇后问题
- hdoj 1019 最小公倍数问题
- HDOJ2553(2N皇后问题)
- 算法入门-数学题之大数问题HDOJ1060&& HDOJ1061
- ZOJ 1610 Count the Colors 线段树区间染色问题
- hdoj 2042 不容易系列之二 解题报告 (老汉牵羊过收费站问题)(超水递推)
- POJ 1207 HDOJ/HDU 1032 3n+1数链问题 绝对不水的解法
- HDU/HDOJ 1025 Constructing Roads In JGShining's Kingdom(道路问题,LIS)
- HDOJ 1276 士兵队列训练问题
- 二分图(1)--染色问题
- hdoj2045不容易系列之(3)—— LELE的RPG难题