Page 1 of 12

10055 - Hashmat the Brave Warrior

Posted: Fri May 03, 2002 3:22 pm
by Shahid
whats the maximum input?

i.e. i want to know if the number 4294967296(2^32) can be given as any of the input?

in c++, the highest unsigned long range is i found 4294967295, so this is important to know....plz help

Posted: Sat May 04, 2002 12:37 am
by Stefan Pochmann
Read the problem description. It says: "The input numbers are not greater than 2^32." That should answer your question.

Posted: Sun May 05, 2002 3:00 am
by Shahid
i make a solution for the highest (2^32) number and it shows right answers. it needs a special treatment cauze it is outside the range of unsigned long in c/c++......
without this i think this a subtraction problem.....

but still i get wrong answer....so is there any other holes that is hidden in the problem?

Posted: Sun May 05, 2002 3:07 am
by Stefan Pochmann
Read the problem description veeery carefully. There's a part that says "vice versa" or sth like that.

Wrong Answer

Posted: Sun Jun 16, 2002 6:43 pm
by Ming Han
My code as follows:
[cpp]
// ACM Problem 10055
// Hashmat the brave warrior
// Done by Teh Ming Han

#include <stdio.h>

int main(){
unsigned long i=0,j=0,ch=0;
while (scanf("%d %d",&i,&j)==2){
if (i>j)ch = i-j;
else ch=j-i;
printf("%d\n",ch);
}
return 0;
}[/cpp]

What i don't understand is why I get wrong answer.

Posted: Sun Jun 16, 2002 6:49 pm
by 10153EN
Try this
4294967296 0

Posted: Sun Jun 16, 2002 6:50 pm
by Caesum
read the first two posts and that should answer your problem

Thanks

Posted: Sun Jun 16, 2002 7:00 pm
by Ming Han
Thanks a lot

10055 - Hashmat the brave warrior; What's the trick here?

Posted: Wed Aug 28, 2002 11:02 am
by Vartanov Daniel
I really didn't understand, how to get WA for this problem, and i understood it after i posted my solution. Is there some tricks in this problem?

Code: Select all

#include <stdio.h>

int main()
{
  unsigned long hashmat, versa;
  while (scanf("%ld %ld", &hashmat, &versa) == 2)
    printf("%ld\n", versa - hashmat);
  return 0;
}
[/cpp]

Posted: Wed Aug 28, 2002 11:18 am
by Adrian Kuegel
This problem has already a thread where your question is answered. Why it is so difficult to use something like "find in page" and insert the problem number?

Posted: Wed Aug 28, 2002 3:49 pm
by karl
Adrian, we are a little bit lazy, aren't we? :wink:

But before scanning hundreds of postings, I'll try to help!!!


Given input a, b, it isn't said, that a<b in every case.
Try input and you'll find something very interesting...
12 10

Read problem description very carefully, second sentence of the "Input" section!

Hope, this helps.

Posted: Wed Aug 28, 2002 8:00 pm
by Vartanov Daniel
Thanks a lot... it was my fault, may be because of bad English :))))

hared in easyyyyyyyyyyyyyyyy???

Posted: Thu Aug 29, 2002 9:34 am
by saugata bose
it returns value vice versa
1st value may be small or greater


saugata

Posted: Thu Sep 05, 2002 11:20 am
by arnsfelt
The input numbers are not greater than 2^32

10055 - i can't find a problem here

Posted: Sat Sep 28, 2002 4:51 pm
by Joana Lopes
:oops:
Well i've read carefully the problem and i'm still receiving a wrong answer.
I know i't a very simple problem maybe i'm becoming blind..
int main()
{
int army1,army2;
while(scanf("%d %d",&army1, &army2)!=EOF)
{
if (army2>=army1)
{
printf("%d\n",(army2-army1));
}
else
printf("%d\n",(army1-army2));
}

return 0;
}

please answer me.
Thanks