|
Way to think out... of your mind.
|
|
|
|
|
i'll keep it your problem
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
I'm an Engineer and I can solve the problem.
How many of the doors you want opened at the end and what is your budget?
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
A little help in the hard way:
namespace MPOTD
{
class Program
{
static void Main(string[] args)
{
Int16[] doors = new Int16[1000];
foreach (int door in doors)
{
doors[door] = -1;
}
for (Int16 unlocker = 1; unlocker <= 1000; unlocker++)
{
if (doors[unlocker - 1] % unlocker == 0)
doors[unlocker - 1] *= -1;
}
Int16 NrUnlocked = 0;
Int16 NrLocked = 0;
foreach (int door in doors)
{
if (doors[door] == -1)
NrLocked++;
else
NrUnlocked++;
}
Console.WriteLine(string.Format("Unlocked: {0}. Locked: {1}", NrUnlocked, NrLocked));
Console.ReadKey();
}
} }
Result: All unlocked
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Reread that. The answer is incorrect.
|
|
|
|
|
Pressed F5, same answer
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Look at door number two. Person one unlocks it. Person two relocks it. Nobody else touches it. It is locked at the end.
|
|
|
|
|
U31
L969
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Correct. Now try it without the program.
|
|
|
|
|
easy:
1000 = 10^3
so 3 * 10 = 30 and door 1 stays unlocked so 31
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Try it for 10 doors and 10 people. Pattern recognition.
|
|
|
|
|
don't get too serious
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
11 is the perfect answer
(You only have to change the base)
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Nope... the perfect answer is 42
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
digimanus wrote: U31 You sunk my battleship!
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I contacted you by mariphone but you did not respond in a proper time. The TimeOutException was raised, which make you sunk.
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Just how big is your game board? O.o
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
Quote: if (doors[unlocker - 1] % unlocker == 0) Why you check the STATE of the lock against the 'unlocker'? You should check the POSITION of the door...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Changed that to:
for (Int16 unlocker = 1; unlocker <= 1000; unlocker++)
{
for (int door = 0; door < 1000; door++)
{
if ((door+1) % unlocker == 0)
doors[door] *= -1;
}
}
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
You can cut it down to for (int door = unlocker - 1; door < 1000; door++) ... and 'unlocker' never will touch the door before his own position...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
n^2
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Don't forget to take away the number you first thought of.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
31
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Very good, now tell me: Who owns the zebra?
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|