|
-
March 25th, 2011, 09:58 PM
#1
wrong answer on spoj.pl???
why spoj.pl judge gives me wrong answer????
problem #24 Small factorials
here is the code:
using System;
class Program
{
static void Main()
{
long t = 0, n = 0, d = 0;
long c = 0;
t = Convert.ToInt64(Console.ReadLine().Trim());
while (c < t)
{
n = Convert.ToInt64(Console.ReadLine().Trim());
if (n < 100) ;
d= factorial(n);
Console.WriteLine(d);
c++;
}
}
static long factorial(long d)
{
long c = 0;
long e = 1;
long j = 1;
while (c<d)
{
j = j * e;
c++;
e++;
}
return j;
}
}
the code runs ok on visual basic, but spoj online judge gives me wrong answer... helppp.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|