AC answer
2023-11-15 12:39:47
发布于:安徽
4阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int n;
int north[25],east[25],west[25];
void work()
{
cin>>n;
north[1]=east[1]=west[1]=1;
for(int i=2;i<=n;i++)
{
north[i]=east[i-1]+west[i-1]+north[i-1];
east[i]=north[i-1]+east[i-1];
west[i]=north[i-1]+west[i-1];
}
cout<<north[n]+east[n]+west[n];
}
int main()
{
work();
return 0;
}
这里空空如也
有帮助,赞一个