提交时间:2024-08-20 09:05:57

运行 ID: 168264

#include<cstdio> long long a[2]={0,9},b[2]={0,1},i,n; int main() { scanf("%lld",&n); for(i=2;i<=n;i++) { a[i%2]=b[(i-1)%2]+9*a[(i-1)%2]; b[i%2]=a[(i-1)%2]+9*b[(i-1)%2]; } printf("%lld",a[n%2]-a[(n-1)%2]); return 0; }