Competitive Programming: POJ 2663 – Tri Tiling

 

Description

In how many ways can you tile a 3xn rectangle with 2×1 dominoes?

Here is a sample tiling of a 3×12 rectangle.

Tri Tiling

Input

Input consists of several test cases followed by a line containing -1. Each test case is a line containing an integer 0 <= n <= 30.

Output

For each test case, output one integer number giving the number of possible tilings.

Sample Input

2
8
12
-1

Sample Output

3
153
2131

Link to problem

Solution below . . .

Read more

Aside

We come and we go . . . that’s a thing that I keep in the back of my head . . .

Tom Wolfe, 1930-2018

 

Everything that bloggers have done for journalism — and I personally think they’ve done a lot — Wolfe did it first, he did it 30 years earlier, and he did it better. And I think we’re still catching up to him.

Tom Wolfe had a rare combination of ideas, insight and a virtuosity with language. A lot of writers do well with at most one out of the three. You can read Tom Wolfe quotes all over the web but I include one of my favorites (from The Bonfire of the Vanities) here:

Sherman made the terrible discovery that men make about their fathers sooner or later . . . that the man before him was not an aging father but a boy, a boy much like himself, a boy who grew up and had a child of his own and, as best he could, out of a sense of duty and, perhaps love, adopted a role called ‘Being a Father’ so that his child would have something mythical and infinitely important: a Protector, who would keep a lid on all the chaotic and catastrophic possibilities of life.

RIP Tom Wolfe

Tom Wolfe

Girls With Working Moms Fare Better?

 
Working woman

Via LinkedIn:

Girls who grow up with working moms are more likely to have careers themselves and to have higher paying jobs in the future, according to a report in Fortune, citing study data. The research found that, “daughters of working mothers in the U.S. make about 23% more than daughters of stay-at-home mothers.”

This article is headlined — inaccurately, in my view — Girls with working moms fare better.

Shouldn’t the headline stay with the facts and say “Girls with working moms make more money” instead of “Girls with working moms fare better”?

“Fare better”

  1. seems to reflect an inappropriately narrow obsession with money as the only metric for measuring life outcomes.
  2. misrepresents facts to promote an opinion, i.e., “working moms are good for society.”

Developers Should Abandon Agile

 

No matter what framework or method your management thinks they are applying, learn to work this way:

  • Produce running, tested, working, integrated software every two weeks, every week. Build your skills until you can create a new fully operational version every day, twice a day, multiple times a day.
  • Keep the design of that software clean. As it grows, the design will tend to become complex and crufty. Resist and reverse this tendency consciously, refactoring in tiny continuous steps, all the time, so that your rate of progress is as steady and consistent as possible.
  • Use the current increment of software as the foundation for all your conversations with your product leadership and management. Speak in terms of what’s ready to go, and in terms of what they’d like you to do next.
  • This is the development team’s best hope for a reasonable life. By keeping the software always ready to go, we can hit any deadline with the best possible result. “Is today the deadline? Here’s what we’ve got, it’s ready to ship.”

All Cars Look the Same

 

Maserati

I’m not a car guy but I do miss the days when every car on the road didn’t look like every other car. This occurred to me today as I was driving behind a Maserati that, if not for the Maserati logo, would have been indistinguishable from a Hyundai Sonata.

Also, if you Photoshop a BMW grill onto a Kia, you really can’t tell them apart.

Fact Checking the Fact Checkers

 

PolitiFact

PolitiFact has a article headlined “Donald Trump’s NRA speech, fact-checked”.

Here’s a sample:

“African-American unemployment has reached another all-time, in history, record low … And the same thing with Hispanic American unemployment, which is also at the lowest level in history — unemployment, lowest level in history. And women’s unemployment — women, many women — is at the lowest level in almost 20 years. Think of that.”

The “fact check” starts out like this:

As far as the numbers go, Trump is correct.

It then goes on for another five paragraphs to say that Barack Obama deserves “at least as much” credit as Trump for low unemployment.

That’s a fact check?!

Trump didn’t even say anything about who deserves the credit, although the listener is invited to make a favorable inference.

Had he added “. . . and I deserve all the credit,” it would be fair in that case for PolitiFact to add some context around why he might not deserve all the credit, but he didn’t say that.

I hate “fact checking.” I don’t hate the checking of facts but I hate the practice of “fact checking” as it’s done by media organizations.

Almost all media organizations are agenda-driven while pretending they’re not. “Fact checking” is a larger-than-usual deception in that we’re being told that someone made a false statement and the fact checkers are doing the Lord’s work in pointing it out.

But the “facts” being checked are often not facts at all. Here’s another “fact check” from the Trump NRA speech:

“We’re going to take people into our country but they’re going to come in based on merit, not based on picking somebody out of a bin”

I can’t even find a fact to be checked there, but PolitiFact objects to the diversity visa lottery being characterized as “picking somebody out of a bin”:

Trump claims countries send people, but the lottery is run by the United States, not foreign countries.

I copied the Trump statement just the way PolitiFact printed it — I didn’t take anything out — and there’s nothing in there about countries sending people.

Even when an actual fact is checked, like the unemployment numbers, and even when the fact is stated correctly, the “fact checkers” can’t resist putting their own spin on it.

Look! Even an undisputed fact that we don’t like can be “fact checked” in a way that makes us feel comfortable presenting it as false.

 

The fact checkers, in my opinion, actually torpedo their own efforts before even getting to the “fact checks.”

The article starts off like this:

After a week of news about Stormy Daniels, President Donald Trump headed to Dallas to speak to members of the National Rifle Association.

OK . . . credibility problem! “A week of news about Stormy Daniels”? The article has nothing to do with Stormy Daniels, she’s not mentioned again, there were other things — believe it or not — that happened in the country and the world last week that had nothing to do with Stormy Daniels.

The media love Stormy Daniels. Her attorney has been on CNN more in the last two months than most of the CNN hosts have been on in the last two months.

But putting Stormy Daniels in the lead sentence of an article about an NRA speech is a totally gratuitous swipe of the sort that you’d think impartial “fact checkers” would be able to resist.

Things to Do With an Amputated Limb

 

I saw a guy in a men’s room today, on his way out, checking himself in the mirror and making a gesture with his hand like he was adjusting his hair, except he was totally bald.

Some people, after having a limb amputated, can feel the limb as if it were still there. Does this also happen with hair?

If you have a limb amputated, do you get to take it home with you? I’d like to stick my amputated arm up my sleeve and shake hands with people.

Think of how great that would be on Halloween: “Have some candy, kid. AAAAAAHHHHHHH! MY ARM!”

Alfie Evans, 2016-2018

 

Thank god this could never happen here in the US . . . at least until Bernie Sanders is inaugurated.

RIP Alfie Evans

Generic LinkedIn Recommendation

 

LinkedIn icon

Feel free to use it:

When you meet him, he will act upon you, whether you know it or not.

What he says or does may seem inconsistent or even incomprehensible to you. But it has its meaning. He does not live entirely in your world.

His intuition is that of the rightly guided, and he always works in accordance with the Right Way.

He may discomfit you. That will be intended and necessary.

He may seem to return good for evil, or evil for good. But what he is really doing is known only to the Few.

You may hear that some men oppose him. You will find that few men really do.

He is modest and allows you to find out what you have to find out slowly.

When you first meet him, he may seem to be very different from you. He is not. He may seem to be very much like you. He is not.