You can isolate it to three balls not four, by mixing your sets when weighing...
You should prbably stop reading if you don't want to see a solution. Maybe this sentence will get me past the compression filter? Hooray it did!
Anyway here's some code that solves the problem in 3 weighings, being perl it should be sufficiently unreadable to allow those who want to work it out themselves to look away before it gives away the trick. The choice of marbles for the second weighing guarantees we have only three contenders for the odd marble for the final weighing...
#!/usr/bin/perl -w use strict;
# change one of these to a 9 or 11:) our @m = (10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10); our $weighings = 0;
sub weigh { my $left = shift; my $right = shift; my $scale = 0; $weighings++; $scale+=$_ for @$right; $scale-=$_ for @$left; $scale; }
my $w1 = weigh([@m[0,1,2,3]], [@m[4,5,6,7]]); my $w2 = weigh([@m[4,5,6,3]], [@m[8,9,10,7]]);
#If $w1 is 0, we could weigh 0,1,2 against 8,9,10 which would take #us to the else part with @down_to_three=(8,9,10) is the result wasn't 0 #if it was 0 then 11 is the odd marble, so we can just weigh it against #any other marble to get the answer - but adding the extra known normal #ball to each side doesn't hurt, and lets is use the more general check...
if ($w1==$w2) { my $w3 = weigh([$m[7]], [$m[11]]); if ($w3==0) { if ($w1>0) { print "Marble 3 is lighter\n"; } elsif ($w1<0) { print "Marble 3 is heavier\n"; } else { print "All marbles are the same\n"; } } elsif ($w3>0) { if ($w1>0) { print "Can't happen\n"; } elsif ($w1<0) { print "Marble 7 is lighter\n"; } else { print "Marble 11 is heavier\n"; } } else { if ($w1>0) { print "Marble 7 is heavier\n"; } elsif ($w1<0) { print "Can't happen\n"; } else { print "Marble 11 is lighter\n"; } } } else { my @down_to_three; my $type; if ($w1==0) { @down_to_three = (8,9,10); if ($w2>0) { $type = 'heavier'; } else { $type = 'lighter'; } } elsif ($w2==0) { @down_to_three = (0,1,2); if ($w1>0) { $type = 'lighter'; } else { $type = 'heavier'; } } else { @down_to_three = (4,5,6); if ($w1>0) { $type = 'heavier'; } else { $type = 'lighter'; } } my $w3 = weigh([$m[$down_to_three[0]]],[$m[$down_to_three[1 ]]]); if ($w3==0) { print "Marble $down_to_three[2] is $type\n"; } elsif ($w3>0) { if ($type eq 'heavier') { print "Marble $down_to_three[1] is heavier\n"; } else { print "Marble $down_to_three[0] is lighter\n"; } } else { if ($type eq 'heavier') { print "Marble $down_to_three[0] is heavier\n"; } else { print "Marble $down_to_three[1] is lighter\n"; } } }
log-base-2 of n is not optimal for that problem, so it's not surporising you missed stage 2... And you aren't supposed to be told whether the odd marble is heavier or lighter, working that out is part of the problem.
It's doable in O(log-base-3 of n), well log3(2n+3) to be precise...
That's using a balance which compares the weight of two sets of marbles.
We're 240 volts down here too, and we have switches in the bathroom. Does the power point for the electric shaver/hairdryer uses a switch anyway in the UK?
Anyway amperage is what kills you, voltage just provides the pleasant jolting feeling:)
And given Watts = Voltage * Current, a lower voltage requires more current for a given watt light bulb (of course in practice a light bulb wattage is determined by the resistance - so halving the voltage will half the current and hence quarter the wattage, though I assume you 120V people have 60W light bulbs which pull 120V and 0.5 amps, compared with ours which pull 240V and 0.25 amps.)
Of course I haven't looked at my electric circuit equations since I lived in that bedroom in high school, so I probably got something wrong...
My current keyboard is very different from the one on my first computer. My current one has a bunch of extra buttons above the function keys. It has a numeric keypad. It has a few extra keys around the space bar. The relative sizes of the keys are different. And the shape of some has changed.
My mouse is different from my first mouse as well. My first computer didn't even have a mouse, and there wasn't one available for it either. It doesn't require a mouse pad to work, it has a bunch of extra button, conveniantly placed where my fingers and thumbs rest. It even has a little wheel thing on top.
Sure the basic idea of a thing with buttons which your press hasn't changed. Then again I still turn a steering wheel to point my car in the direction I wish to travel. And press pedal things with my feet to make it go faster or slower.
I'll go as far to say that there are only two interface changes I recall in my lifetime that have been beneficial i without the change having a technical cause (so not having to tell the car which gear to be in with a stick doesn't count because it was caused by the introduction of automatic transmissions, for example). The first being light switches instead of pull cords - so you can actually tell if the light is off or on when you need to change a burnt out bulb without trying to remember if you pulled the cord and even or odd number of times when the light didn't come on. And the remote control for controlling everything from the comfort of the couch.
Of course there will be others, that I just don't remember because the new interface is now so obvious that the previous stupid one is a repressed memory.
My new ISP has a pretty standard TOS. You can't do illegal things, or violate copyrights, trademarks, etc, etc. There's no guarantee of any service at all and they can terminate the agreement at a whim (and if you don't pay and are reselling they get to grab your customers, but I won't and I don't)... There's a nasty bit about service people coming onto your premises, but I don't have any of their hardware anyway...
However, in relation to running servers they are great the relevant FAQ entry even has some humour (if you want a static IP you need the business service at this ISP):
Can I run a 'server' on my Internode Personal ADSL service, even though the IP address is dynamic? Yes, if you want to do that, you are welcome to do that. Be aware that the Personal ADSL service is not designed for this, but it doesn't prohibit it.
In particular, since your IP address is dynamic (it varies over time), this means you can't run a server and expect its 'internet location' to remain fixed in time.
So its fine for short term server situations (if you want to put up a server so a friend can download something from your computer, or whatever).
Be aware that if you wind up running a mail server, and it winds up being a spam relay, we will terminate your connection with extreme predjudice and without warning, until you fix your computer up so that it doesn't do that any more.
Ditto if your computer suddenly turns into a robot on behalf of one of the many weird and wonderful ways that Windows can be compromised by nasty script kiddies.
The price of freedom is eternal vigilance (or something).
And they seem to encourage NAT, setting things up so that even people who can't work out how to turn on ICS in windows (let alone run a linux type NATing firewall) can plug an ethernet ADSL modem into a hub and run PPPoE clients on each machine seperately. I suspect this would negatively affect the speed (probably splitting the bandwidth equally between connections - rather than sharing like in NAT), but I might have to try it soon just in case:)
A book specifically written about the domain you are interested has more relevant content than multiple books written about the larger domains your subdomain is a part of.
I'm truly shocked.
Next you'll be saying that if I want to learn how to build a wooden chair a book called 'How to build a wooden chair' would have more relevant content than both 'Carpentry 101' and 'Wood: from Trees to Sawmills'.
While we aren't charged for incoming calls in Australia, many plans do have a charge for the storage (and/or retrieval) of messages left when you didn't answer or the phone was off/out of service area.
The article was fine, that you didn't read it properly is your problem and not the author's. The first sentence (outside the summary) is:
Evans Data Corporation hired me to help out with a research report focused on Linux developers.
Which neatly states that the developers being talked about are Linux developers.
Of course the slashdot writeup doesn't bother mentioning this, but such things are expected in what passes for summaries on slashdot.
It's all those damn deductions, and rebates and crap.
When I rule the world there shall be a progressive tax system with no deductions or rebates at all.
Damn simple, with the wonders of these new inventions called calculators, calculating your tax is as simply as entering your income with the conveniant number pad, and pressing the 'Calculate' button. Your tax will be displayed. You can pick up a calculator free of charge in any newsagency.
If you don't trust those new fangled calculator things you can look at a simple table and find the row representing your income giving you the numbers X, Y, and Z. Your income is I. The result of Y+Z*(I-X) is your tax.
Those with higher incomes pay more tax (proportionally) because the economic system we have doesn't reward 'work' in a just manner. People who are very good at allocating capital get orders of magnitude more income than those who are very good at the production of food. This unfairness is inherit in the system, however, the system is far better than any other known system, so it's best we tinker with the edges to redress the problems.
Oh yes, and as supreme ruler you can pay your taxes by making out a cheque to me. Doing this before I become ruler will speed up the process of me becoming supreme ruler. Thanks.
Patents should expire if you don't do anything with them for 2 years.
Oh yeah, that'd be a great system.
So If some genius inventor invents some process for making a new gee-whiz alloy/ceramic/whatever which would say increase the safety while also decreasing weight and production costs of cars significantly - enough to say save car companies a few billion dollars a year. However, in order to move the thing off the lab top and into real production would require a few billion dollars of investment and would also infringe on a few patents held by car manufacturers.
Would the car companies:
A. Buy the rights to the patent for *lots* of money and make the stuff?
B. License their patents to someone (say the inventor) or some company who will make the stuff?
C. Do nothing for 2 years, and have the patent invalidated thus saving *lots* of money and making the stuff themselves a bit later?
Over the last 30 years the federal government (of Australia, since that's where I'm from) has spent almost $65,000,000,000 (that's Australian dollars, so I guess that's about 75c US) more than it has taken in revenue, compared with the US that doesn't seem like much I guess. But Australia is a small country (population wise), the federal government receipts for 2001-02 were $165,000,000,000 (and at the start of my 30 year sum were only $8,000,000,000).
Hence our federal government has provided more than it has taken (ignoring the minor detail of interest payments and other expenses to foreign interests which are an expense, but are not provided to us).
Of course a closer look at the figures will show that $68,000,000,000 of that defecit (ie. more than all of it) occurred in a five year period, in the first half of 1990s.
My, my, you guys have strange ways of doing things.
I guess I must have seen a report from a random corporation that used April 1 sometime in the distant past and incorrectly extrapolated from one data point.
I guess having the fiscal year staggered means there's always some greater than expected loss to be reported on the news, instead of a whole bunch all at once:)
Might stagger the tax work for the accountants too (though having individuals all be the same would ruin that I guess)...
If every one of our 53,000 subscribers brings in just ONE additional subscription, Salon will finally break even this year
That sounds like they're stuffed to me.
If they double their subscription base, they will break even. Not make a profit. Break even.
I guess they might be factoring in the 33% discount on "gifts", so maybe they only need a 66% increase in their subscriber base. Even so, that doesn't sound promising to me.
There's also the definition of 'this'. The financial year in the US starts on April 1, right? So maybe they mean if in the last month of the financial year, they earn as much money in subscriptions as for the other 11 months combined, they'll break even. If so that bodes even worse for the next year...
I'm especially amused at the bit about $3.50 apiece (or $10 for the whole set) being expensive. And here I paid sixty bucks for the three core D&D3 books and felt like I was getting a deal.
Since the median income* of the USA was about $8500 in 1974 and in 2001 was about $29,000 the price now is about double the price of 1974 (which is about the same as you get with inflation figues - which would be $10->$35).
Of course the modern D&D product is of far higher quality - paper and production wise (content is of course a matter of taste) explaining the price increase.
* Figures from http://www.census.gov/hhes/income/histinc/p07.html
MoD files aren't stored under my home directory (which is all the ~ is going to search under after all).
And they aren't available over the internet which seemed to be all they care about (ignoring idiot honours students and their insecure code, since they've all left anyway)...
I'm a Usyd student and I've known about this was happening for a reasonable amount of time.
I did a "find ~ -name '*.mp3'" when I first heard about it and was disappointed that I only had three mp3 files. None of which were music, and all of which were legally obtained.
Since I felt like I'd be missing out I copied one of the directories in my web space and then renamed the files to be.mp3 files. Of course it's pretty obvious that a file that is a couple of kilobytes in size and named index.html.mp3 isn't in fact a Metallica track. But, maybe I'll get to join in the fun...
You can isolate it to three balls not four, by mixing your sets when weighing...
:)
You should prbably stop reading if you don't want to see a solution. Maybe this sentence will get me past the compression filter? Hooray it did!
Anyway here's some code that solves the problem in 3 weighings, being perl it should be sufficiently unreadable to allow those who want to work it out themselves to look away before it gives away the trick. The choice of marbles for the second weighing guarantees we have only three contenders for the odd marble for the final weighing...
#!/usr/bin/perl -w
use strict;
# change one of these to a 9 or 11
our @m = (10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10);
our $weighings = 0;
sub weigh {
my $left = shift;
my $right = shift;
my $scale = 0;
$weighings++;
$scale+=$_ for @$right;
$scale-=$_ for @$left;
$scale;
}
my $w1 = weigh([@m[0,1,2,3]], [@m[4,5,6,7]]);
my $w2 = weigh([@m[4,5,6,3]], [@m[8,9,10,7]]);
#If $w1 is 0, we could weigh 0,1,2 against 8,9,10 which would take
#us to the else part with @down_to_three=(8,9,10) is the result wasn't 0
#if it was 0 then 11 is the odd marble, so we can just weigh it against
#any other marble to get the answer - but adding the extra known normal
#ball to each side doesn't hurt, and lets is use the more general check...
if ($w1==$w2) {
my $w3 = weigh([$m[7]], [$m[11]]);
if ($w3==0) {
if ($w1>0) {
print "Marble 3 is lighter\n";
} elsif ($w1<0) {
print "Marble 3 is heavier\n";
} else {
print "All marbles are the same\n";
}
} elsif ($w3>0) {
if ($w1>0) {
print "Can't happen\n";
} elsif ($w1<0) {
print "Marble 7 is lighter\n";
} else {
print "Marble 11 is heavier\n";
}
} else {
if ($w1>0) {
print "Marble 7 is heavier\n";
} elsif ($w1<0) {
print "Can't happen\n";
} else {
print "Marble 11 is lighter\n";
}
}
} else {
my @down_to_three;
my $type;
if ($w1==0) {
@down_to_three = (8,9,10);
if ($w2>0) {
$type = 'heavier';
} else {
$type = 'lighter';
}
} elsif ($w2==0) {
@down_to_three = (0,1,2);
if ($w1>0) {
$type = 'lighter';
} else {
$type = 'heavier';
}
} else {
@down_to_three = (4,5,6);
if ($w1>0) {
$type = 'heavier';
} else {
$type = 'lighter';
}
}
my $w3 = weigh([$m[$down_to_three[0]]],[$m[$down_to_three[1 ]]]);
if ($w3==0) {
print "Marble $down_to_three[2] is $type\n";
} elsif ($w3>0) {
if ($type eq 'heavier') {
print "Marble $down_to_three[1] is heavier\n";
} else {
print "Marble $down_to_three[0] is lighter\n";
}
} else {
if ($type eq 'heavier') {
print "Marble $down_to_three[0] is heavier\n";
} else {
print "Marble $down_to_three[1] is lighter\n";
}
}
}
print "Used $weighings weighings\n";
Nope. You can do it in three always.
HINT TO FOLLOW - READING FURTHER MAY REDUCE FUN
.
.
.
.
.
.
.
.
.
The key is to split it into three sets instead of two sets at the start...
log-base-2 of n is not optimal for that problem, so it's not surporising you missed stage 2... And you aren't supposed to be told whether the odd marble is heavier or lighter, working that out is part of the problem.
It's doable in O(log-base-3 of n), well log3(2n+3) to be precise...
That's using a balance which compares the weight of two sets of marbles.
We're 240 volts down here too, and we have switches in the bathroom. Does the power point for the electric shaver/hairdryer uses a switch anyway in the UK?
:)
Anyway amperage is what kills you, voltage just provides the pleasant jolting feeling
And given Watts = Voltage * Current, a lower voltage requires more current for a given watt light bulb (of course in practice a light bulb wattage is determined by the resistance - so halving the voltage will half the current and hence quarter the wattage, though I assume you 120V people have 60W light bulbs which pull 120V and 0.5 amps, compared with ours which pull 240V and 0.25 amps.)
Of course I haven't looked at my electric circuit equations since I lived in that bedroom in high school, so I probably got something wrong...
Stagnated?
My current keyboard is very different from the one on my first computer. My current one has a bunch of extra buttons above the function keys. It has a numeric keypad. It has a few extra keys around the space bar. The relative sizes of the keys are different. And the shape of some has changed.
My mouse is different from my first mouse as well. My first computer didn't even have a mouse, and there wasn't one available for it either. It doesn't require a mouse pad to work, it has a bunch of extra button, conveniantly placed where my fingers and thumbs rest. It even has a little wheel thing on top.
Sure the basic idea of a thing with buttons which your press hasn't changed. Then again I still turn a steering wheel to point my car in the direction I wish to travel. And press pedal things with my feet to make it go faster or slower.
I'll go as far to say that there are only two interface changes I recall in my lifetime that have been beneficial i without the change having a technical cause (so not having to tell the car which gear to be in with a stick doesn't count because it was caused by the introduction of automatic transmissions, for example). The first being light switches instead of pull cords - so you can actually tell if the light is off or on when you need to change a burnt out bulb without trying to remember if you pulled the cord and even or odd number of times when the light didn't come on. And the remote control for controlling everything from the comfort of the couch.
Of course there will be others, that I just don't remember because the new interface is now so obvious that the previous stupid one is a repressed memory.
A really crappy half a volt amplifier on a noisy circuit.
However, in relation to running servers they are great the relevant FAQ entry even has some humour (if you want a static IP you need the business service at this ISP):
And they seem to encourage NAT, setting things up so that even people who can't work out how to turn on ICS in windows (let alone run a linux type NATing firewall) can plug an ethernet ADSL modem into a hub and run PPPoE clients on each machine seperately. I suspect this would negatively affect the speed (probably splitting the bandwidth equally between connections - rather than sharing like in NAT), but I might have to try it soon just in case
Who posts to usenet without checking the FAQ or doing a web search aren't you.
A book specifically written about the domain you are interested has more relevant content than multiple books written about the larger domains your subdomain is a part of.
I'm truly shocked.
Next you'll be saying that if I want to learn how to build a wooden chair a book called 'How to build a wooden chair' would have more relevant content than both 'Carpentry 101' and 'Wood: from Trees to Sawmills'.
As does googling every other host name they have in the database (well not a cache of google.com but of the host searhced for :)
While we aren't charged for incoming calls in Australia, many plans do have a charge for the storage (and/or retrieval) of messages left when you didn't answer or the phone was off/out of service area.
Better hope people who don't like you don't make some ads with your mobile number on them and stick them up.
And the "senior official" who approves the "bombardment" better make sure it isn't President Hu Jintao's phone or that of some random army officer...
Sorry, I misinterpreted what "article" meant :)
Damn kids these days.
To grep is to search in general.
To google is some new flash in the pan fad. Just like those "personal computer" things.
I suggest you learn how to read english.
It's all those damn deductions, and rebates and crap.
When I rule the world there shall be a progressive tax system with no deductions or rebates at all.
Damn simple, with the wonders of these new inventions called calculators, calculating your tax is as simply as entering your income with the conveniant number pad, and pressing the 'Calculate' button. Your tax will be displayed. You can pick up a calculator free of charge in any newsagency.
If you don't trust those new fangled calculator things you can look at a simple table and find the row representing your income giving you the numbers X, Y, and Z. Your income is I. The result of Y+Z*(I-X) is your tax.
Those with higher incomes pay more tax (proportionally) because the economic system we have doesn't reward 'work' in a just manner. People who are very good at allocating capital get orders of magnitude more income than those who are very good at the production of food. This unfairness is inherit in the system, however, the system is far better than any other known system, so it's best we tinker with the edges to redress the problems.
Oh yes, and as supreme ruler you can pay your taxes by making out a cheque to me. Doing this before I become ruler will speed up the process of me becoming supreme ruler. Thanks.
So If some genius inventor invents some process for making a new gee-whiz alloy/ceramic/whatever which would say increase the safety while also decreasing weight and production costs of cars significantly - enough to say save car companies a few billion dollars a year. However, in order to move the thing off the lab top and into real production would require a few billion dollars of investment and would also infringe on a few patents held by car manufacturers.
Would the car companies:
A. Buy the rights to the patent for *lots* of money and make the stuff?
B. License their patents to someone (say the inventor) or some company who will make the stuff?
C. Do nothing for 2 years, and have the patent invalidated thus saving *lots* of money and making the stuff themselves a bit later?
Over the last 30 years the federal government (of Australia, since that's where I'm from) has spent almost $65,000,000,000 (that's Australian dollars, so I guess that's about 75c US) more than it has taken in revenue, compared with the US that doesn't seem like much I guess. But Australia is a small country (population wise), the federal government receipts for 2001-02 were $165,000,000,000 (and at the start of my 30 year sum were only $8,000,000,000).
Hence our federal government has provided more than it has taken (ignoring the minor detail of interest payments and other expenses to foreign interests which are an expense, but are not provided to us).
Of course a closer look at the figures will show that $68,000,000,000 of that defecit (ie. more than all of it) occurred in a five year period, in the first half of 1990s.
Did you miss the "(along with SDL)" section of the statement? Or do you just have trouble parsing english?
Or maybe you had a problem parsing the "and gaming software" section of the statement?
Or maybe you don't consider anything with 3D graphics to be multimedia? Even if it has sound, and text, and wraps videos around the 3D objects?
My, my, you guys have strange ways of doing things.
:)
I guess I must have seen a report from a random corporation that used April 1 sometime in the distant past and incorrectly extrapolated from one data point.
I guess having the fiscal year staggered means there's always some greater than expected loss to be reported on the news, instead of a whole bunch all at once
Might stagger the tax work for the accountants too (though having individuals all be the same would ruin that I guess)...
If they double their subscription base, they will break even. Not make a profit. Break even.
I guess they might be factoring in the 33% discount on "gifts", so maybe they only need a 66% increase in their subscriber base. Even so, that doesn't sound promising to me.
There's also the definition of 'this'. The financial year in the US starts on April 1, right? So maybe they mean if in the last month of the financial year, they earn as much money in subscriptions as for the other 11 months combined, they'll break even. If so that bodes even worse for the next year...
Of course the modern D&D product is of far higher quality - paper and production wise (content is of course a matter of taste) explaining the price increase.
* Figures from http://www.census.gov/hhes/income/histinc/p07.htm
MoD files aren't stored under my home directory (which is all the ~ is going to search under after all).
And they aren't available over the internet which seemed to be all they care about (ignoring idiot honours students and their insecure code, since they've all left anyway)...
After copying it elsewhere of course...
.mp3 files. Of course it's pretty obvious that a file that is a couple of kilobytes in size and named index.html.mp3 isn't in fact a Metallica track. But, maybe I'll get to join in the fun...
I'm a Usyd student and I've known about this was happening for a reasonable amount of time.
I did a "find ~ -name '*.mp3'" when I first heard about it and was disappointed that I only had three mp3 files. None of which were music, and all of which were legally obtained.
Since I felt like I'd be missing out I copied one of the directories in my web space and then renamed the files to be