码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 2569: 彼岸

时间:2017-09-11 22:40:00      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:main   link   16px   color   bsp   out   http   彼岸   ace   


///@author Sycamore
///@date 9/11/2017
///@link http://acm.hdu.edu.cn/showproblem.php?pid=2569
#include<bits/stdc++.h>
using namespace std;
int num[40];
int main()
{
	num[1] = 3; num[2] = 9; 
	for (int i = 3; i < 40; i++)
		num[i] = 2 * num[i - 1] + num[i - 2];
	ios::sync_with_stdio(false);
	cin.tie(0);
	int c;
	cin >> c;
	while (c--)
	{
		int n;
		cin >> n;
		cout << num[n] << ‘\n‘;
	}
	return 0;
}

 

HDU 2569: 彼岸

标签:main   link   16px   color   bsp   out   http   彼岸   ace   

原文地址:http://www.cnblogs.com/zjnu/p/7507266.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!