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 1012. K-based Numbers. Version 2

CHIDEMYAN SERGEY WHY WA#6?HERE IS MY CODE!!THANK!!!! [11] // Problem 1012. K-based Numbers. Version 2 23 Mar 2007 17:32
#include<iostream.h>
#include<stdio.h>
int main()
{
    int n,i,k;unsigned __int64 a[2000],p;
    cin>>n>>k;a[1]=k-1;a[2]=k*(k-1);
        for(i=3;i<=n;i++)
        {a[i]=(k-1)*(a[i-1]+a[i-2]);p=a[i];}
        if(n==1)
            cout<<k-1;
        else
            if(n==2)
                cout<<k*(k-1);
            else
                if(n>=3)
                    printf("%I64u", p);


    return 0;
}

Edited by author 10.04.2007 21:30

Edited by author 10.04.2007 21:31

Edited by author 10.04.2007 21:32
I've got WA#6 too
Me too!
I have no idea!I have submit 3 times
I WA at test 6 !My Good!
remdy21 wrote 20 July 2009 17:59
I have no idea!I have submit 3 times
My AC code for input
10 170
gives
20035832260288179816689
Compare this to the max value of unsigned __int64:
18446744073709551615
Yeah, in this problem the answer can be bigger than int64. Use high precision instead, or Java.
我操!高精度?
"我操!高精度?"
      What?!

Edited by author 14.12.2011 12:24

Edited by author 14.12.2011 12:24

Edited by author 14.12.2011 12:24
Stiller wrote 14 December 2011 12:23
"我操!高精度?"
      What?!

Edited by author 14.12.2011 12:24

Edited by author 14.12.2011 12:24

Edited by author 14.12.2011 12:24
It means "F*CK!  High precision?"
It's not just High precision!
Easy : 6 8 2 6 4 1 3 means 3146286
Hard : 286 146 3 means 3146286