10323 - Factorial! You Must be Kidding!!!
Moderator: Board moderators
-
- New poster
- Posts: 16
- Joined: Sun Mar 07, 2004 12:19 pm
- Location: Dhaka
-
- Learning poster
- Posts: 60
- Joined: Sun Apr 16, 2006 7:59 pm
10323 factorial u must kidding
Always the judge's reply is.... Compilation error.
Anyone pls pls help me fixing that;
here's my code:
thanks.
Anyone pls pls help me fixing that;
here's my code:
Code: Select all
#include <stdio.h>
#include <math.h>
void main()
{
long long n,fact,i;
while( scanf("%lld",&n)==1)
{
if(n < 0)
{
fact=-n;
if( fact > 13)
{
if( fact % 2 == 0)printf("Overflow!\n");
else printf("Underflow!\n");
}
else
{
fact=1;
for(i=n; i<=-1; i++) fact*=i;
if( fact < 10000) printf("Underflow!\n");
else if (fact > 6227020800) printf("Overflow!\n");
else printf("%lld\n",fact);
}
}
else if(n == 0) printf("Underflow!\n");
else
{
if( n > 13) printf("Overflow!\n");
else
{
fact=1;
for(i=n; i>=1; i--) fact*=i;
if( fact < 10000) printf("Underflow!\n");
else if (fact > 6227020800) printf("Overflow!\n");
else printf("%lld\n",fact);
}
}
}
}
-
- Experienced poster
- Posts: 136
- Joined: Fri Apr 15, 2005 3:47 pm
- Location: Singapore
- Contact:
I think the problem of your code is this part :
Hope it helps...
Code: Select all
else if (fact > 6227020800) printf("Overflow!\n");
10323 WA >>>>NEED HELP
this is my code but idont know why i m getting wrong ans....
#include<stdio.h>
int main()
{
int i;
while((scanf("%d",&i))==1)
{
if(i<8)printf("Underflow!\n");
else if(i>13)printf("Overflow!\n");
else if(i==8)printf("40320\n");
else if(i==9)printf("362880\n");
else if(i==10)printf("3628800\n");
else if(i==11)printf("39916800\n");
else if(i==12)printf("479001600\n");
else if(i==13)printf("6227020800\n");
}
return 0;
}
#include<stdio.h>
int main()
{
int i;
while((scanf("%d",&i))==1)
{
if(i<8)printf("Underflow!\n");
else if(i>13)printf("Overflow!\n");
else if(i==8)printf("40320\n");
else if(i==9)printf("362880\n");
else if(i==10)printf("3628800\n");
else if(i==11)printf("39916800\n");
else if(i==12)printf("479001600\n");
else if(i==13)printf("6227020800\n");
}
return 0;
}
10323 txt file missing
I am having peculiar prb while submiting 10323
when i try to submit code it says
There is 1 error:
* TEST FILES MISSING. The problem can't be judged
Uploaded source was NOT submitted
here is my code
can anyone help me!!
when i try to submit code it says
There is 1 error:
* TEST FILES MISSING. The problem can't be judged
Uploaded source was NOT submitted
here is my code
Code: Select all
#include "stdio.h"
long long fact(long long x)
{
if(x==0||x==1)
return 1;
else
return x*fact(x-1);
}
void main()
{
long long n;
while (scanf("%lld",&n)!=EOF)
{
if(n<0){
n=-n;
if(n%2==0)
printf("Underflow!\n");
else
printf("Overflow!\n");
}
else{
if(n<8)
printf("Underflow!\n");
else if(n>13)
printf("Overflow!\n");
else
printf("%lld\n",fact(n));
}
}
}
You have to paste your in the 'source code' section, or you can upload your code. And another important thing. Dont open a new thread if there is one already.
Ami ekhono shopno dekhi...
HomePage
HomePage
Oops my mistake. Goto volume 103. You will see that there is no tick mark for this problem. It means, the input file is missing or there is some problem. So, you cant submit it now. Check the problem after some time.
Ami ekhono shopno dekhi...
HomePage
HomePage
Good.
This problem is plain wrong. Division by 0 is undefined, not +/- infinity. It is good to see that at least the judge admin is doing something about it.
This problem is plain wrong. Division by 0 is undefined, not +/- infinity. It is good to see that at least the judge admin is doing something about it.
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
-
- New poster
- Posts: 23
- Joined: Thu Jul 27, 2006 2:43 pm
- Location: University of Dhaka,Bangladesh
Why judge response WA,
I need help
I need help
Code: Select all
Code removed after AC.
Last edited by jainal cse du on Sat Mar 31, 2007 11:23 am, edited 1 time in total.
-
- New poster
- Posts: 39
- Joined: Mon Dec 04, 2006 2:18 pm
- Location: Bangladesh(CSE DU)
- Contact:
Hi,
For jainal- Are you sure your program gives the correct output? The output for 13 is not correct and it gives output also for n=14. But 13 is the upper limit by the program defination.
For n=13 the output should be 6227020800 and for n>13 it will be overflow. But your program gives wrong output for n=13 and also gives wrong for n>13.
There also a problem i can't understand in your code
Why LL?
Please explaine it.
ABDULLAH
For jainal- Are you sure your program gives the correct output? The output for 13 is not correct and it gives output also for n=14. But 13 is the upper limit by the program defination.
For n=13 the output should be 6227020800 and for n>13 it will be overflow. But your program gives wrong output for n=13 and also gives wrong for n>13.
There also a problem i can't understand in your code
Code: Select all
#define N 6227020800LL
Please explaine it.
ABDULLAH
but why this is WA
Last edited by bishop on Tue Jun 19, 2007 7:54 pm, edited 1 time in total.