Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int rec(int L[], int N, int deg, int F [] ) {
- int Kath=N;
- int Deg=0;
- if (N==0)
- return 0;
- while (Kath>=10){
- Kath=Kath%10;
- Deg++;
- }
- if (Kath==0)
- return rec(L, N%int(pow(10,Deg)), F, Deg);
- for (int i=0;i<10; i++){
- if (i<Kath-1)
- L[i]=L[i]+F[Deg]*(Kath-1)+pow(10,Deg);
- else
- L[i]=L[i]+F[Deg]*(Kath-1);
- }
- return rec(L, N%int(pow(10,Deg)), F, Deg);
- }
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- int N;
- int F[4];
- F[0]=0;
- F[1]=1;
- F[2]=20;
- F[3]=300;
- int L[10];
- cin>>N;
- int deg
- for (int i=1; i<N; i++)
- L[i]=0;
- rec(L, N, F);
- for (int i=0; i<10; i++){
- cout << L[i] << endl ;
- }
- return 0;
- }
- //?g
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement