#1
|
|||
|
|||
somebody post a puzzle already
preferably a logic heavy puzzle as im not too good with any type of advanced math
thanks work svcks that is all |
#2
|
|||
|
|||
Re: somebody post a puzzle already
There are one thousand lockers and one thousand students in the school. The principal asks the first student to go to every locker and open it. Then he has the second student go to every second locker and close it. The third goes to every third locker and, if it is closed, he opens it, and if it is open, he closes it. The fourth student does this to every fourth locker, and so on. After the process is completed with the thousandth student, how many lockers are open? cheers |
#3
|
|||
|
|||
Re: somebody post a puzzle already
Not going to come up with total answer, but here is how you do it in white
<font color="white">Number of perfect squares between 1 and 1000 </font> |
#4
|
|||
|
|||
Re: somebody post a puzzle already
Results in white below:
<font color="white">Label the lockers 1, 2, 3, etc. A locker will be open if and only if its label is has an odd number of divisors. Only the perfect squares have an odd number of divsors (every divisor of a non-square n is paired with a different divisor of n) so the only lockers that will be open are labeled with perfect squares. The answer is thus the number of perfect squares between 1 and 1000, inclusive.</font> |
#5
|
|||
|
|||
Re: somebody post a puzzle already
wouldnt that be 31? or is that too easy?
|
#6
|
|||
|
|||
Re: somebody post a puzzle already
<font class="small">Code:</font><hr /><pre> Dim i As Integer 'i will be the ith door that student n is currently on
Dim n As Integer 'n will be the student currently opening doors n = 1 i = 1 Dim doorindex As Long For n = 1 To 1000 For i = 1 To 1000 doorindex = i * n If doorindex <= 1000 Then If wksht.Cells(n * i, 1) = "c" Then 'open it wksht.Cells(n * i, 1) = "o" Else 'close it wksht.Cells(n * i, 1) = "c" End If Else GoTo nextkid End If Next nextkid: Next </pre><hr /> gives 31 doors, all the squares. |
#7
|
|||
|
|||
Re: somebody post a puzzle already
Meh.
|
#8
|
|||
|
|||
Re: somebody post a puzzle already
[ QUOTE ]
GoTo [/ QUOTE ] Boo. |
#9
|
|||
|
|||
Re: somebody post a puzzle already
[ QUOTE ]
[ QUOTE ] GoTo [/ QUOTE ] Boo. [/ QUOTE ] Here, I agree. However: Rubin, Frank. "'GOTO Considered Harmful' Considered Harmful" (letter to the editor), Communications of the ACM, vol. 30, no. 3 (March 1987), pp. 195-6. |
#10
|
|||
|
|||
Re: somebody post a puzzle already
Did you just bust out code for a logic problem? Doesn't that kind of defeat the purpose.
I agree with boo GoTo. That was 10th grade VB6 man, you're better than that. |
|
|