10344 - 23 out of 5
Moderator: Board moderators
10344 - 23 out of 5
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?
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?
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.
10344 WA
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]
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]
Hello!
Can the 5 numbers be swapped?
If not, whhy 1 2 3 4 5 = possible?
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
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Not specified
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.
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.
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
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).
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 ...
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
-
- New poster
- Posts: 5
- Joined: Tue Jun 14, 2005 7:12 pm
Problem Fixed
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!
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!