hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
'Bit Test' challenge... the strange coding.. please help me.
Goto page 1, 2, 3, 4  Next
 
Reply to topic    hacker.org Forum Index » Challenges View previous topic
View next topic
'Bit Test' challenge... the strange coding.. please help me.
Author Message
dorahan



Joined: 27 May 2008
Posts: 105
Location: Jakarta, Indonesia.

Post 'Bit Test' challenge... the strange coding.. please help me. Reply with quote
please help me to solve this challenge... i never seen a coding with 'bool' word like that before... please help me an explain to me about this coding.. and how to solve the challenge... thanks so much..

_________________
~� dorahan �~
Sun Jun 22, 2008 2:23 pm View user's profile Send private message
therethinker



Joined: 28 Mar 2008
Posts: 144
Location: #hacker.org on Freenode

Post Reply with quote
Seriously, what languages HAVE you seen!?

That code is C.
Sun Jun 22, 2008 3:19 pm View user's profile Send private message AIM Address
dorahan



Joined: 27 May 2008
Posts: 105
Location: Jakarta, Indonesia.

Post Reply with quote
What? that is C code?? I have learned a bit of C++. But i never seen that kind of word... Maybe it's the advanced level of C... huehehhee... i think i only learned the beginner level of C... hahahaha... huhuhuhu... T_T

_________________
~� dorahan �~
Mon Jun 23, 2008 9:53 am View user's profile Send private message
therethinker



Joined: 28 Mar 2008
Posts: 144
Location: #hacker.org on Freenode

Post Reply with quote
Well, to be fair, it is also C++. (C is practically a subset of C++) Its not really that advanced, either.
Mon Jun 23, 2008 2:51 pm View user's profile Send private message AIM Address
dorahan



Joined: 27 May 2008
Posts: 105
Location: Jakarta, Indonesia.

Post Reply with quote
Ohh i really don't know about that.. anyway i haven't solved this challenge... please give me any clue to solve this... i promise to study more about C. @__@

_________________
~� dorahan �~
Mon Jun 23, 2008 3:35 pm View user's profile Send private message
therethinker



Joined: 28 Mar 2008
Posts: 144
Location: #hacker.org on Freenode

Post Reply with quote
Study more C and you'll find the answer Wink
Tue Jun 24, 2008 1:26 am View user's profile Send private message AIM Address
dorahan



Joined: 27 May 2008
Posts: 105
Location: Jakarta, Indonesia.

Post Reply with quote
Argghhh please give me any clue to solve this problemm... I'm frustated already... Have no idea at all...

_________________
~� dorahan �~
Wed Jul 02, 2008 4:00 pm View user's profile Send private message
Suriv



Joined: 02 Aug 2008
Posts: 4

Post bit test Reply with quote
Try to test the function by sending random values and take a look to the output,
after passing a bunch of values you will see a pattern.
then it will be easy to find the answer.
Sun Aug 24, 2008 3:08 am View user's profile Send private message
chriskag



Joined: 02 Sep 2008
Posts: 5

Post Reply with quote
Hello hackers.
This is my first post.
My English isn't so good.
You see, I'm from Greece and I don't know how to translate some things in English.
I am also new in Linux, thanks to this forum, and I don't know how to run a c++ project.
Neither how to find and install translators, programs, etc.
I managed to solve some of the tests in windows, which I am using for years, but Linux is hard for me.

About the test, I can only say that
it has an integer input
it tests if both values (&) have the price of zero

But how can x and x-1 have the same price?
I think it always return false (-1)

Could you please help me?
Thu Sep 25, 2008 11:12 am View user's profile Send private message
canine



Joined: 14 Sep 2008
Posts: 189

Post Reply with quote
In most languages, C and C++ included, true is any non-zero number.

This makes -1 true.

0 is the only false value.

Otherwise I don't know much more about this puzzle.

Oh, to compile a C or C++ program on GNU/Linux, you would do:

Code:
gcc file.c -o file
, if it's a c program

OR
Code:

gcc file.cpp -o file -lstdc++
, if it's a c++ program.

Obviously change file.cpp or file.c to the filename of the source code. If they compile without problem, you can go ahead and do:

Code:
./file


Which will run the code.
Thu Sep 25, 2008 2:01 pm View user's profile Send private message
chriskag



Joined: 02 Sep 2008
Posts: 5

Post Reply with quote
Thank you canine
You've been very helpfull
Sat Sep 27, 2008 1:43 pm View user's profile Send private message
canine



Joined: 14 Sep 2008
Posts: 189

Post Reply with quote
chriskag wrote:
Thank you canine
You've been very helpfull


Anytime.
Sat Sep 27, 2008 5:12 pm View user's profile Send private message
tails



Joined: 10 Jun 2008
Posts: 191
Location: Tokyo

Post Reply with quote
wangyudian wrote:
but i don't know what (format: 'blank of blank') mean!


It's like "something of something", or /.* of .*/ in regex.
Wed Oct 15, 2008 1:16 pm View user's profile Send private message
skragglies



Joined: 15 Jul 2008
Posts: 16
Location: Illinois

Post Reply with quote
I know the answer...I think. I mean I know what the function does, but I can't seem to word it correctly, and I speak english as a native language...

Nevermind, I just realized there are three ways to say it in a blank of blank format. I was only trying two of them.
Thu Oct 16, 2008 4:09 am View user's profile Send private message
tails



Joined: 10 Jun 2008
Posts: 191
Location: Tokyo

Post Reply with quote
Hey, do not write the answer here!
It spoils the challenge. Everyone can see it.
You should delete it as soon as possible.

Edit: Thanks.
Mon Oct 27, 2008 11:12 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Challenges All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.