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

WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by CHIDEMYAN SERGEY 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
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by yaho0o0 8 Apr 2009 00:53
I've got WA#6 too
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by wjwjwjwj 20 Jul 2009 09:05
Me too!
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by remdy21 20 Jul 2009 17:59
I have no idea!I have submit 3 times
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by wanghong 31 Jul 2009 19:15
I WA at test 6 !My Good!
remdy21 wrote 20 July 2009 17:59
I have no idea!I have submit 3 times
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by icanwin 21 Oct 2009 02:42
+1
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by melkiy 21 Oct 2009 02:56
My AC code for input
10 170
gives
20035832260288179816689
Compare this to the max value of unsigned __int64:
18446744073709551615
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by tiancaihb 21 Oct 2009 08:44
Yeah, in this problem the answer can be bigger than int64. Use high precision instead, or Java.
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by Mao Zedong 27 May 2011 14:29
我操!高精度?
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by Stiller 14 Dec 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
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by Aaron Zeng 21 Dec 2011 01:20
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?"
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
Posted by the114514 21 Apr 2022 18:09
It's not just High precision!
Easy : 6 8 2 6 4 1 3 means 3146286
Hard : 286 146 3 means 3146286