ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1009. K-based Numbers

WA#2
Posted by Navid 11 Nov 2011 22:19
I don't know.I thought it's true.
Recursive algrithm is true.
c++:

#include<iostream>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    long long int A[11][17];
    for(int i=2;i<11;i++)
            A[0][i]=1;
    for(int i=2;i<11;i++)
            A[1][i]=i-1;
    for(int i=2;i<11;i++)
            for(int j=2;j<17;j++)
            {
                   A[i][j]=(j-1)*(A[i-1][j]+A[i-2][j]);
            }
    cout<<A[n][k];
    cin>>n;
    return 0;
}
Re: WA#2
Posted by Navid 11 Nov 2011 22:22
I got Ac.Size of A was small.