Author Archive: Paul Epps

Competitive Programming: POJ 2185 – Milking Grid

 

Description Every morning when they are milked, the Farmer John’s cows form a rectangular grid that is R (1 <= R <= 10,000) rows by C (1 <= C <= 75) columns. As we all know, Farmer John is quite the expert on cow behavior, and is currently writing a book about feeding behavior in cows. He notices that if each cow is labeled with an uppercase letter indicating its breed, the two-dimensional pattern formed by his cows during milking sometimes seems to be made from smaller repeating rectangular patterns. Help FJ find the rectangular unit of smallest area that can be repetitively tiled to make up the entire milking grid. Note that the dimensions of the small rectangular unit do not necessarily need to divide evenly the dimensions of the entire milking grid, as indicated in the sample input below. Input Line 1: Two space-separated integers: R and C… Read more →

Teaching Computer Science: Say Your Ideas Out Loud

 

[I learned about Scary Ideas from Jim and Michele McCarthy — PE] I’m volunteering a couple mornings a week in a high school computer science class . . . “The main thing I wanted to tell you is that you’ve got to say your ideas out loud . . . “A scary idea is not an idea that’s going to scare people when they hear it, it’s an idea that you don’t want to say because you’re afraid of how people will react to it. Maybe they’ll think you’re crazy. “Here’s a couple examples of scary ideas. “You recognize the speaker in this video?” Everyone does. “Ok, let’s see what he has to say.” I believe that this nation should commit itself to achieving the goal, before this decade is out, of landing a man on the moon and returning him safely to the earth. “Keep in mind that he’s… Read more →

A Close Encounter with Burt Reynolds’ Legacy

 

I’m having dinner at a Japanese restaurant . . . in the booth behind me are a couple straight out of Sons of Anarchy. The man is about 45, large, with a shaved head, tattoos and a motorcycle jacket. Same description for the woman, except for the shaved head. Her jacket is emblazoned with PROPERTY OF TROG (or FROG or ????, couldn’t make it out clearly), which I assume is the name of either a motorcycle gang or the gentleman sitting across from her. Midway through the meal, Trog wonders aloud if Smokey and the Bandit is available on Netflix. To his chagrin, the movie doesn’t seem to register with his girlfriend, so to jog her memory, he pulls up the “Eastbound and Down” song on his phone and plays it loudly enough to be heard by everyone in the vicinity. He then launches into an analysis of the film… Read more →

Competitive Programming: POJ 1147 – Binary Codes

 

Description Consider a binary string (b1…bN) with N binary digits. Given such a string, the matrix of Figure 1 is formed from the rotated versions of the string. b1 b2 … bN-1 bN b2 b3 … bN b1 … bN-1 bN … bN-3 bN-2 bN b1 … bN-2 bN-1 Figure 1. The rotated matrix Then rows of the matrix are sorted in alphabetical order, where ‘0’ is before ‘1’. You are to write a program which, given the last column of the sorted matrix, finds the first row of the sorted matrix. As an example, consider the string (00110). The sorted matrix is 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 0 and the corresponding last column is (1 0 0 1 0). Given this last column your program should determine the first row, which is… Read more →

Competitive Programming: POJ 1961 – Period

 

Description For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 <= i <= N) we want to know the largest K > 1 (if there is one) such that the prefix of S with length i can be written as AK, that is A concatenated K times, for some string A. Of course, we also want to know the period K. Input The input consists of several test cases. Each test case consists of two lines. The first one contains N (2 <= N <= 1,000,000) – the size of the string S. The second line contains the string S. The input file ends with a line, having the number zero on it. Output For each test case, output “Test… Read more →

Teaching Computer Science: All Are Welcome

 

I’m volunteering a couple mornings a week in a high school computer science class . . . “Computing,” I tell the class, “is like most professions in that some groups are under-represented and some groups are over-represented. You may have heard that the reason some groups are under-represented is because computing as a profession is more welcoming to some people than others. “I haven’t found that to be the case and I’ll tell you why. “My perspective on this is that if you walk through the workplace at a typical technology company, you won’t see people who look like me. I’m too old and I’ve been too old for quite a while now. At this point, I’m usually old enough to be the CEO’s father. “So to the extent that people want to work with other people who look like them and people who fit into the group, that doesn’t… Read more →

EppsNet Book Reviews: An Inconvenient Woman by Dominick Dunne

 

It’s a good murder mystery, but about two-thirds of the way through, I felt like I couldn’t indulge the author’s sexual obsessions any further and just flipped ahead to see whodunit. Every man has either “a dick like a mule” or “a dick like a Tampax.” No one has ” a dick of average proportions.” Sexual relationships are either non-existent (with one’s wife) or preposterously frequent and varied (with one’s mistress(es)). One unlikely plot device is premised on a particular woman’s “most intimate scent.” I’d suggest that the author have his head examined but he’s been dead for nearly 10 years . . . Read more →

Teaching Computer Science: Don’t Worry About Spelling and Grammar?

 

The following is part of the Code.org online curriculum, asking students to write a brief reflection on starting a computer science class. That seems like an oddball thing to say in an educational context. “Let’s talk about the instructions here for a minute,” I said to the class. “One: it doesn’t make sense to me to compartmentalize education like this. Like spelling and grammar are only important in an English class and this is not an English class so don’t worry about it. “We’ll be taking a holistic view of education here. I hope you’ll learn some things about computer science but I hope you’ll learn some other things as well. “On a practical note, you may find yourself competing for a job someday, and if it’s a good job, there are likely to be a lot of applicants. “No one wants to read a large number of resumes, so… Read more →

Teaching Computer Science: Why Was I Not Consulted?

 

I’m volunteering in a high school computer science class a couple mornings a week . . . If you’re going to work with computers, you need to be able to move around between different number systems, most commonly base 10, base 2 and base 16. As a warm-up, I asked students how many ways they could represent the quantity 7. Answers included the word “seven,” roman numerals, seven dots, a septagon, a Chinese symbol, and so on. “Quantities exist naturally,” I said, “but number systems are man-made. They’re just a set of symbols along with an agreement about how to order them. Why do we use the number system that we do? Who decided that?” Because I phrased it in a provocative way, some students realized that they hadn’t been consulted. “Yeah, no one asked me,” one student said. “Raise your hand in math class,” I suggested, “and ask ‘Why… Read more →

Competitive Programming: POJ 2074 – Line of Sight

 

Description An architect is very proud of his new home and wants to be sure it can be seen by people passing by his property line along the street. The property contains various trees, shrubs, hedges, and other obstructions that may block the view. For the purpose of this problem, model the house, property line, and obstructions as straight lines parallel to the x axis: Input Because each object is a line, it is represented in the input file with a left and right x coordinate followed by a single y coordinate: <x1> <x2> <y> where x1, x2, and y are non-negative real numbers, x1 < x2 . An input file can describe the architecture and landscape of multiple houses. For each house, the first line will have the coordinates of the house. The second line will contain the coordinates of the property line. The third line will have a… Read more →

Company Picnic

 

A highly placed manager at work shows up next to me in the men’s room. “You going to the company picnic?” he shouts. He’s a boisterous guy. “Yes!” I reply. “Looking forward to taking a few throws at you in the dunk tank.” “Dunk tank?!” he says. “There’s not going to be any dunk tank.” “Oh . . . in that case I’m not going.” Read more →

Competitive Programming: POJ 2318 – TOYS

 

Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem – their child John never puts his toys away when he is finished playing with them. They gave John a rectangular box to put his toys in, but John is rebellious and obeys his parents by simply throwing his toys into the box. All the toys get mixed up, and it is impossible for John to find his favorite toys. John’s parents came up with the following idea. They put cardboard partitions into the box. Even if John keeps throwing his toys into the box, at least toys that get thrown into different bins stay separated. The following diagram shows a top view of an example toy box. For this problem, you are asked to determine how many toys fall into each partition as John throws them into… Read more →

Boil the Ocean

 

My first thought is that “Don’t boil the ocean” is not very good advice because boiling the ocean is not a use case that anyone actually has. Why advise people not to do something that no one would do anyway? My second thought was: why not boil the ocean? Add some onion, garlic, white wine . . . you might get a really nice cioppino! Serves . . . well, I don’t know how many it would serve, but a lot! Read more →

Life Gets Better After 50?

 

About 15 years ago, economists made an unexpected finding: the U-shaped happiness curve. Other things being equal – that is, once conditions such as income, employment, health and marriage are factored out of the equation – life satisfaction declines from our early 20s until we hit our 50s. Then it turns around and rises, right through late adulthood. — The Guardian So once you factor out all the things that make life miserable, it turns out older people can be just as happy as anyone else! Read more →

Sources Say . . .

 

We can never allow our sources to make allegations, contentious statements or vituperative attacks behind a cloak of anonymity. It weakens our credibility and gives the sources an opportunity to benefit at our expense. It is fundamentally unfair to the other party and thus biased. . . . If a source wants to make a vituperative attack on an individual, organisation, company or country he or she must speak on the record. — Reuters Handbook of Journalism Read more →

Competitive Programming: POJ 1905 – Expanding Rods

 

Description When a thin rod of length L is heated n degrees, it expands to a new length L’=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on two solid walls and then heated, it expands and takes the shape of a circular segment, the original rod being the chord of the segment. Your task is to compute the distance by which the center of the rod is displaced. Input The input contains multiple lines. Each line of input contains three non-negative numbers: the initial lenth of the rod in millimeters, the temperature change in degrees and the coefficient of heat expansion of the material. Input data guarantee that no rod expands by more than one half of its original length. The last line of input contains three negative numbers and it should not be processed. Output For each line of input, output one… Read more →

« Previous PageNext Page »