英文
Time Limit:1s Memory Limit:256M
Description
N grid in a line.Using three colour(red,pink and green) to dye the grid,each grid dyeing one colour,the rule is every two adjacent grid should be different colour,and the first grid and the last grid in the line should be different colour.Please calculate the ways you dye.
Input
One integer n 1<=n<=50
Output
One integer.
Sample Input
2
Sample Output
6
中文
时间:1s 空间:256M
题目描述:
有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不能同色,且首尾两格也不同色.求全部的满足要求的涂法.
输入格式:
输入一个整数n
输出格式:
输出一个整数
样例输入:
2
样例输出:
6
约定:
0<=n<=50
提示:
看到这题后,是不是准备先来个暴力?没错,暴力已经准备好了:
#include <iostream>
#include <cstdio>
#include <string>