Click here to Skip to main content
15,906,333 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Oi! SteveTheThread! Where is the CCC? Pin
SteveTheThread12-Sep-16 0:53
SteveTheThread12-Sep-16 0:53 
GeneralRe: Oi! SteveTheThread! Where is the CCC? Pin
OriginalGriff12-Sep-16 1:00
mveOriginalGriff12-Sep-16 1:00 
GeneralMPOTD Pin
Bassam Abdul-Baki11-Sep-16 23:49
professionalBassam Abdul-Baki11-Sep-16 23:49 
GeneralRe: MPOTD PinPopular
OriginalGriff11-Sep-16 23:57
mveOriginalGriff11-Sep-16 23:57 
GeneralRe: MPOTD Pin
Bassam Abdul-Baki12-Sep-16 0:11
professionalBassam Abdul-Baki12-Sep-16 0:11 
GeneralRe: MPOTD Pin
Herman<T>.Instance11-Sep-16 23:59
Herman<T>.Instance11-Sep-16 23:59 
GeneralRe: MPOTD Pin
den2k8812-Sep-16 0:17
professionalden2k8812-Sep-16 0:17 
GeneralRe: MPOTD Pin
Herman<T>.Instance12-Sep-16 0:18
Herman<T>.Instance12-Sep-16 0:18 
A little help in the hard way:
C#
namespace MPOTD
{
    class Program
    {
        static void Main(string[] args)
        {
            // -1 is locked and 1 is unlocked
            Int16[] doors = new Int16[1000];

            //INIT
            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.

GeneralRe: MPOTD Pin
Bassam Abdul-Baki12-Sep-16 0:24
professionalBassam Abdul-Baki12-Sep-16 0:24 
GeneralRe: MPOTD Pin
Herman<T>.Instance12-Sep-16 0:44
Herman<T>.Instance12-Sep-16 0:44 
GeneralRe: MPOTD Pin
Bassam Abdul-Baki12-Sep-16 0:47
professionalBassam Abdul-Baki12-Sep-16 0:47 
GeneralRe: MPOTD Pin
Herman<T>.Instance12-Sep-16 0:52
Herman<T>.Instance12-Sep-16 0:52 
GeneralRe: MPOTD Pin
Bassam Abdul-Baki12-Sep-16 0:55
professionalBassam Abdul-Baki12-Sep-16 0:55 
GeneralRe: MPOTD Pin
Herman<T>.Instance12-Sep-16 1:18
Herman<T>.Instance12-Sep-16 1:18 
GeneralRe: MPOTD Pin
Bassam Abdul-Baki12-Sep-16 1:19
professionalBassam Abdul-Baki12-Sep-16 1:19 
GeneralRe: MPOTD Pin
Herman<T>.Instance12-Sep-16 1:25
Herman<T>.Instance12-Sep-16 1:25 
GeneralRe: MPOTD Pin
Kornfeld Eliyahu Peter12-Sep-16 1:27
professionalKornfeld Eliyahu Peter12-Sep-16 1:27 
GeneralRe: MPOTD Pin
Nelek12-Sep-16 2:20
protectorNelek12-Sep-16 2:20 
GeneralRe: MPOTD Pin
Kornfeld Eliyahu Peter12-Sep-16 2:23
professionalKornfeld Eliyahu Peter12-Sep-16 2:23 
JokeRe: MPOTD Pin
ZurdoDev12-Sep-16 1:10
professionalZurdoDev12-Sep-16 1:10 
GeneralRe: MPOTD Pin
Herman<T>.Instance12-Sep-16 1:19
Herman<T>.Instance12-Sep-16 1:19 
GeneralRe: MPOTD Pin
den2k8812-Sep-16 3:23
professionalden2k8812-Sep-16 3:23 
GeneralRe: MPOTD Pin
Kornfeld Eliyahu Peter12-Sep-16 0:53
professionalKornfeld Eliyahu Peter12-Sep-16 0:53 
GeneralRe: MPOTD Pin
Herman<T>.Instance12-Sep-16 1:04
Herman<T>.Instance12-Sep-16 1:04 
GeneralRe: MPOTD Pin
Kornfeld Eliyahu Peter12-Sep-16 1:11
professionalKornfeld Eliyahu Peter12-Sep-16 1:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.