#include <iostream> #include <cmath> using namespace std; typedef long long ll; //typedef unsigned long long ll; //const ll inf=9999999999999; ll a[36]; ll b[36]; int main() { a[0]=1; b[0]=0; for(int i=1;i<35;i++) { a[i]=3*a[i-1]+2*b[i-1]; b[i]=a[i-1]+b[i-1]; } int n; while(cin>>n) { if(n==-1) break; cout<<a[n]<<", "<<b[n]<<endl;//dp[n]<<endl; } return 0; }
时间: 2024-10-12 12:31:24