#include <iostream> #define n 20 using namespace std; int main() { #define int unsigned long long int x; cin>>x; int T[n]; for (int i=0;i<n;++i) T[i]=0; T[0]=1; for (int i=1;;++i) { if(x==0) {cout<<T[i-1];break;} T[i]+=(x%10+1)*T[i-1]; if(x%100>9&&x%100<19) T[i+1]=T[i-1]*(19-x%100); x-=x%10; x/=10; } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <iostream> #define n 20 using namespace std; int main() { #define int unsigned long long int x; cin>>x; int T[n]; for (int i=0;i<n;++i) T[i]=0; T[0]=1; for (int i=1;;++i) { if(x==0) {cout<<T[i-1];break;} T[i]+=(x%10+1)*T[i-1]; if(x%100>9&&x%100<19) T[i+1]=T[i-1]*(19-x%100); x-=x%10; x/=10; } return 0; } |