#include <bits/stdc++.h> using namespace std; int main() { int n, p=17607, a[100001]; cin >> n; a[0]=1; a[1]=7; a[2]=179; for(int i=4; i<=n+1; i++) a[i]=a[i-1]+a[i-2]+a[i-3]; for(int i=4; i<=n+1; i++) { p++; p*=2; if(p>a[i]) a[i]=(a[i]+2)*3; else if(p<a[i]) a[i]=(a[i]++)*2; else a[i]=a[i++]*3; } printf("%d", &a[n+1]); return 0; }
共 1 条回复
?