mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
26 lines
396 B
C++
26 lines
396 B
C++
|
#include<string.h>
|
||
|
#include<cstdio>
|
||
|
#include<iostream>
|
||
|
#include<algorithm>
|
||
|
const int MAX=31;
|
||
|
int s[MAX];
|
||
|
using namespace std;
|
||
|
int main()
|
||
|
{
|
||
|
int i,n;
|
||
|
s[0]=1;
|
||
|
s[2]=3;
|
||
|
for(i=4;i<MAX;i+=2)
|
||
|
{
|
||
|
s[i]=4*s[i-2]-s[i-4];
|
||
|
}
|
||
|
while(cin>>n,n>=0)
|
||
|
{
|
||
|
if(n&1)
|
||
|
cout<<0<<endl;
|
||
|
else
|
||
|
cout<<s[n]<<endl;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|