'Bit Test' challenge... the strange coding.. please help me.

dorahan
Posts: 105
Joined: Tue May 27, 2008 10:36 am
Location: HkRkoz al KuwaiT 2019 HaCkEr 101

'Bit Test' challenge... the strange coding.. please help me.

Post by dorahan »

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 �~
HkRkoz al KuwaiT 2019 HaCkEr 101
therethinker
Posts: 144
Joined: Fri Mar 28, 2008 11:29 pm
Location: #hacker.org on Freenode

Post by therethinker »

Seriously, what languages HAVE you seen!?

That code is C.
dorahan
Posts: 105
Joined: Tue May 27, 2008 10:36 am
Location: HkRkoz al KuwaiT 2019 HaCkEr 101

Post by dorahan »

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 �~
HkRkoz al KuwaiT 2019 HaCkEr 101
therethinker
Posts: 144
Joined: Fri Mar 28, 2008 11:29 pm
Location: #hacker.org on Freenode

Post by therethinker »

Well, to be fair, it is also C++. (C is practically a subset of C++) Its not really that advanced, either.
dorahan
Posts: 105
Joined: Tue May 27, 2008 10:36 am
Location: HkRkoz al KuwaiT 2019 HaCkEr 101

Post by dorahan »

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 �~
HkRkoz al KuwaiT 2019 HaCkEr 101
therethinker
Posts: 144
Joined: Fri Mar 28, 2008 11:29 pm
Location: #hacker.org on Freenode

Post by therethinker »

Study more C and you'll find the answer ;-)
dorahan
Posts: 105
Joined: Tue May 27, 2008 10:36 am
Location: HkRkoz al KuwaiT 2019 HaCkEr 101

Post by dorahan »

Argghhh please give me any clue to solve this problemm... I'm frustated already... Have no idea at all...
~� dorahan �~
HkRkoz al KuwaiT 2019 HaCkEr 101
Suriv
Posts: 4
Joined: Sat Aug 02, 2008 4:08 pm

bit test

Post by Suriv »

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.
chriskag
Posts: 5
Joined: Tue Sep 02, 2008 3:43 pm

Post by chriskag »

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?
canine
Posts: 190
Joined: Sun Sep 14, 2008 5:38 am

Post by canine »

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: Select all

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

OR

Code: Select all

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: Select all

./file
Which will run the code.
chriskag
Posts: 5
Joined: Tue Sep 02, 2008 3:43 pm

Post by chriskag »

Thank you canine
You've been very helpfull
canine
Posts: 190
Joined: Sun Sep 14, 2008 5:38 am

Post by canine »

chriskag wrote:Thank you canine
You've been very helpfull
Anytime.
tails
Posts: 191
Joined: Tue Jun 10, 2008 7:51 pm
Location: Tokyo

Post by tails »

wangyudian wrote:but i don't know what (format: 'blank of blank') mean!
It's like "something of something", or /.* of .*/ in regex.
skragglies
Posts: 16
Joined: Tue Jul 15, 2008 8:07 pm
Location: Illinois

Post by skragglies »

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.
tails
Posts: 191
Joined: Tue Jun 10, 2008 7:51 pm
Location: Tokyo

Post by tails »

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.
Post Reply