WHY WA#6?HERE IS MY CODE!!THANK!!!!
#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!!!!
I've got WA#6 too
Re: WHY WA#6?HERE IS MY CODE!!THANK!!!!
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!!!!
I WA at test 6 !My Good!
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!!!!
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!!!!
我操!高精度?
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!!!!
"我操!高精度?"
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!!!!
It's not just High precision!
Easy : 6 8 2 6 4 1 3 means 3146286
Hard : 286 146 3 means 3146286