Page 1 of 6

### 10344 - 23 out of 5

Posted: Mon Sep 16, 2002 11:35 am
I got Runtime Error for this problem 10344 with the following message:

Your program has died with signal 8 (SIGFPE). Meaning:

Floating point excepti

I think it is cause by divided by zero.
But I dont know how it happen.
Could it have zero input int the 5-tuples except the last one?

Posted: Tue Sep 17, 2002 8:28 am
you can check this type of questions using 'abort()' or some different technique (TLE,mem alloc,SIGFPE,SIGSEGV,output exceeds,...) to signal back when the problematical event occures (like specific input, example four zero and a non zero input)

Posted: Tue Sep 17, 2002 1:19 pm
maybe you divide zero or a very small real number, or sqrt(negative number)

Posted: Tue Sep 17, 2002 1:36 pm
i think neither float operation by FPU raise any SIGFPE with it's default control word (in i386 architecture). only integer division by zero does (by CPU).

Posted: Wed Sep 18, 2002 8:35 am
I use abort() to test if the input contain 0.
Yes, it does. The ACM tell a lie again.
The Problem description says:
The Input consists of 5-Tupels of positive Integers, each between 1 and 50.

But I solved this problem using another approch which no using / or %.

### 10344 WA

Posted: Mon Mar 24, 2003 1:39 pm
Can someone help me to find what wrong with my code,or give me some
test input/output..thanks!!
[cpp]
#include <iostream.h>

int intIn[5];
int oper[4];
int intOK;

void sh (int);
void change (int);

void change (int N)
{
int intT,intT2;
int intTemp;

if (N==5)
sh (1);

else if (intOK==0)
{
for (intT=0 ;intT<5-N ; intT++)
{
change (N+1);
intTemp=intIn[N-1];

for (intT2=N-1 ;intT2<4 ;intT2++)
intIn[intT2]=intIn[intT2+1];
intIn[4]=intTemp;
}
}
}
void sh (int N)
{
int intT;
int sum;

if (N==5)
{
sum=intIn[0];

for (intT=0 ;intT<4 ;intT++)
{
switch (oper[intT])
{
case 1:
sum+=intIn[intT+1];
break;
case 2:
sum-=intIn[intT+1];
break;
case 3:
sum*=intIn[intT+1];
break;
}
}

if (sum==23.0)
intOK=1;
}

else if (intOK==0)
{
for (intT=1 ;intT<=3 ;intT++)
{
oper[N-1]=intT;
sh (N+1);
}
}
}

int main()
{
while (cin >> intIn[0] >> intIn[1] >> intIn[2] >> intIn[3] >> intIn[4])
{
if (intIn[0]==0 && intIn[1]==0 && intIn[2]==0 && intIn[3]==0 && intIn[4]==0)
break;
intOK=0;

change (1);

if (intOK==0)
cout << "Impossible" << endl;
else
cout << "Possible" << endl;
}
return 0;
}
[/cpp]

Posted: Sat Jul 12, 2003 5:15 am
Hello!

Can the 5 numbers be swapped?

If not, whhy 1 2 3 4 5 = possible?

Posted: Tue Jul 15, 2003 7:10 pm
i found some dis-similarity between the outputs that your program showed and those of mine;

some of those inputs are:

input:
41 4 2 3 42
3 11 22 33 23
29 23 34 4 6
30 27 6 23 36
21 45 24 22 20
output:
Possible
Possible
Possible
Possible
Possible

### Not specified

Posted: Wed Mar 03, 2004 1:21 pm
Hello Everybody:

This is very sad that there is a mistake in the problem description of
of the problem number 10344(23 out of 5).

They said that there is no such an input data that contain 0.
That is, the input will be from 1 to 50.
But i found 0 in the input set.
This mistake spent my huge times and created frustration.

This should not be happened.

Posted: Wed Mar 03, 2004 3:55 pm
Now that so many fixing mistakes are going on, why don't they fix where fixing is really necessary. Misinforming problem statement can be very frustrating and time consuming.

Posted: Wed Mar 03, 2004 7:47 pm
You can write an email to problemset@acm.uva.es if you notice any mistake in a problem description. Don't complain in the message board, it is not possible for the admins to read all threads (and likewise it is not possible to check every problem, so it is necessary that we, the users of this site, write emails to the admins if we notice a mistake).

Posted: Wed Sep 01, 2004 3:09 am
Can anybody show me how to get 23 from 1 2 3 4 5?

Posted: Wed Sep 01, 2004 9:39 am
minskcity wrote:Can anybody show me how to get 23 from 1 2 3 4 5?
(((3 * 5) - 4) * 2) + 1

Ciao!!!

Claudio

Posted: Thu Sep 23, 2004 6:46 pm
Hello,

I get WA on this problem again and again. Maybe I don't understand the problem description. Tell me if I am wrong:

1) There occurs 0 in the input
2) Could I use division, or only +, *, -? Maybe it's posible if there occurs 0 and you can use division -- that would be the reason for yatsen's runtime error? But in the problem description there is nothing said you can use division ...

### Problem Fixed

Posted: Tue Aug 02, 2005 11:20 pm
Hi,

I reported the fact to the judges that it looks like a 0 appears in the input, and they replied saying that there was, indeed, a single 0 in one of the test cases. He reported that the test case will be changed.

Good Luck!