10344 - 23 out of 5

All about problems in Volume 103. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

yatsen
Learning poster
Posts: 68
Joined: Fri Nov 23, 2001 2:00 am
Location: taiwan

10344 - 23 out of 5

Post by yatsen » 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?

Picard
Learning poster
Posts: 96
Joined: Mon Jun 24, 2002 1:22 pm
Location: Hungary
Contact:

Post by Picard » 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)
Last edited by Picard on Tue Sep 17, 2002 1:37 pm, edited 1 time in total.

tenshi
New poster
Posts: 14
Joined: Tue Jun 25, 2002 8:50 am

Post by tenshi » Tue Sep 17, 2002 1:19 pm

maybe you divide zero or a very small real number, or sqrt(negative number)
http://www.ioiforum.org/en/

A problem discussing forum.
Welcome to discuss problems in it!

Picard
Learning poster
Posts: 96
Joined: Mon Jun 24, 2002 1:22 pm
Location: Hungary
Contact:

Post by Picard » 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).

yatsen
Learning poster
Posts: 68
Joined: Fri Nov 23, 2001 2:00 am
Location: taiwan

Post by yatsen » 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 %.

de
New poster
Posts: 11
Joined: Sat Mar 08, 2003 3:46 pm

10344 WA

Post by de » 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]

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer » Sat Jul 12, 2003 5:15 am

Hello!

Can the 5 numbers be swapped?

If not, whhy 1 2 3 4 5 = possible? :-?
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

Noim
Learning poster
Posts: 88
Joined: Sun Oct 13, 2002 6:11 am
Location: Bangladesh

Post by Noim » 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
__nOi.m....

Mahmud776
New poster
Posts: 22
Joined: Mon Dec 22, 2003 9:29 am
Location: Canada

Not specified

Post by Mahmud776 » 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.

User avatar
shamim
A great helper
Posts: 498
Joined: Mon Dec 30, 2002 10:10 am
Location: Bozeman, Montana, USA

Post by shamim » 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.

Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post by Adrian Kuegel » 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).

minskcity
Experienced poster
Posts: 199
Joined: Tue May 14, 2002 10:23 am
Location: Vancouver

Post by minskcity » Wed Sep 01, 2004 3:09 am

Can anybody show me how to get 23 from 1 2 3 4 5?

CDiMa
Experienced poster
Posts: 214
Joined: Fri Oct 17, 2003 5:49 pm
Location: Genova

Post by CDiMa » 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

kiha
New poster
Posts: 37
Joined: Sat Dec 20, 2003 10:59 pm

Post by kiha » 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 ...
kiha

zac.friggstad
New poster
Posts: 5
Joined: Tue Jun 14, 2005 7:12 pm

Problem Fixed

Post by zac.friggstad » 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!

Post Reply

Return to “Volume 103 (10300-10399)”