Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Are you a economical programer?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Fri Jan 18, 2008 2:53 am    Post subject: Are you a economical programer? Reply with quote

Try this question:
In every cab only 6 people can get in.
Calculate how much cabs you need for X people only with +,-,* and /.
(no if,case/switch,while,for or somthing like that).


You can do it in in one line.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

Joined: 09 May 2003
Posts: 25872
Location: The netherlands

PostPosted: Fri Jan 18, 2008 2:56 am    Post subject: Reply with quote

y=x%6>0 ? (x/6)+1 : x/6;

ok, you didn't say % was allowed, but I like it better this way

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
stealthy17
Expert Cheater
Reputation: 0

Joined: 10 Apr 2007
Posts: 144
Location: The Netherlands

PostPosted: Fri Jan 18, 2008 2:57 am    Post subject: Reply with quote

cabs = x / 6

x being amount of people

hm?
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Fri Jan 18, 2008 2:59 am    Post subject: Reply with quote

@DarkByte: Very nice, there is an easyer way Very Happy


@stealthy17:Wrong, for 7 people you need 2 cabs not one Wink
Back to top
View user's profile Send private message
stealthy17
Expert Cheater
Reputation: 0

Joined: 10 Apr 2007
Posts: 144
Location: The Netherlands

PostPosted: Fri Jan 18, 2008 3:31 am    Post subject: Reply with quote

Well in theory it's true what i wrote.
But in reality you can't drive 0,1666666666666666666666666666667 cab lol.

Guess it could be rounded up if that's allowed? =o
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Fri Jan 18, 2008 7:26 am    Post subject: Reply with quote

stealthy17 wrote:
Well in theory it's true what i wrote.
But in reality you can't drive 0,1666666666666666666666666666667 cab lol.

Guess it could be rounded up if that's allowed? =o

Sorry but it's wrong.


The right and best answer is:
Code:
cabs = (NumOfPpl + 5)\6
Back to top
View user's profile Send private message
stealthy17
Expert Cheater
Reputation: 0

Joined: 10 Apr 2007
Posts: 144
Location: The Netherlands

PostPosted: Fri Jan 18, 2008 7:28 am    Post subject: Reply with quote

Matter of opinion i guess.
Also theory and practicum are 2 differences.

I was right in a theoretical way you are in practicum.
Oh well...
Back to top
View user's profile Send private message
Trow
Grandmaster Cheater
Reputation: 2

Joined: 17 Aug 2006
Posts: 957

PostPosted: Fri Jan 18, 2008 8:42 am    Post subject: Reply with quote

explain your +5 plox

reason to ask you to explain: you didn't say \ is allowed; you said /. and you know they are different. anyways what's data type of cabs?

_________________
Get kidnapped often.
Back to top
View user's profile Send private message
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Fri Jan 18, 2008 9:06 am    Post subject: Reply with quote

+5 is used for the minimal argument, which is, in this case 1:
(1+5)/6=1|...|(6+5)/6=1
The point is the non-fractured calculation(integers only)...
Back to top
View user's profile Send private message
stealthy17
Expert Cheater
Reputation: 0

Joined: 10 Apr 2007
Posts: 144
Location: The Netherlands

PostPosted: Fri Jan 18, 2008 9:33 am    Post subject: Reply with quote

*zips*
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites