提交时间:2024-08-20 20:22:39
运行 ID: 169930
#include <bits/stdc++.h> using namespace std; const int maxn = 1005; long long n,d = 10,x = 9,cnt,a[maxn],i,j; int main(){ cin >> n; if(n == 1) cout << 9 << endl; a[1] = 9; for(i = 2;i <= n;i++){ a[i] = (8 * x + d - x); x += a[i]; d *= 10; } cout << a[n]; return 0; }