EppsNet Archive: Programming

Competitive Programming: POJ 3169 – Layout

Description Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N standing along a straight line waiting for feed. The cows are standing in the same order as they are numbered, and since they can be rather pushy, it is possible that two or… Read more →

Competitive Programming: POJ 1125 -Stockbroker Grapevine

Description Stockbrokers are known to overreact to rumors. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the stock market. For maximum effect, you have to spread the rumors in the fastest possible way. Unfortunately for you, stockbrokers only trust information coming from their “Trusted sources” This… Read more →

Competitive Programming: POJ 2488 – A Knight’s Journey

Description Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. The world of a knight is the chessboard he is living on. Our knight lives… Read more →

Competitive Programming: POJ 1159 – Palindrome

Description A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the minimal number of characters to be inserted into the string in order to obtain a palindrome. As an example, by inserting 2 characters, the… Read more →

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. 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… Read more →

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… Read more →

Competitive Programming: POJ 1426 – Find The Multiple

Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decimal digits. Input The input file may contain multiple test cases.… Read more →

Competitive Programming: POJ 2084 – Game of Connections

Description This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n – 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some straight line segments to connect them into number pairs. Every number must be connected to exactly one… Read more →

Competitive Programming: USACO Big Barn

Farmer John wants to place a big square barn on his square farm. He hates to cut down trees on his farm and wants to find a location for his barn that enables him to build it only on land that is already clear of trees. For our purposes, his land is divided into N x N parcels. The input… Read more →

Competitive Programming: POJ 1654 – Area

Description Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, …. In a subtree whose root node is X, we can get the minimum number in this subtree by repeating going down the left node until the last level, and we can also find the maximum number by going… Read more →

Competitive Programming: POJ 2242 — The Circumference of the Circle

Description To calculate the circumference of a circle seems to be an easy task – provided you know its diameter. But what if you don’t? You are given the cartesian coordinates of three non-collinear points in the plane. Your job is to calculate the circumference of the unique circle that intersects all three points. Input The input will contain one… Read more →

Teaching Computer Science: How to Get Top-Notch Teachers in the Classroom

I read something every day where educators and/or elected officials are talking about the importance for our kids, our country, our future, etc., of teaching computer science, the sticking point being an extreme shortage of qualified teachers. A person entering the workforce with a computer science degree is unlikely to go into teaching because of the opportunity cost: they can… Read more →

Teaching Computer Science: The Phones Aren’t Helping You

I’m volunteering a couple mornings a week at a local high school, helping out with computer science classes. The way the classes are taught, via an online curriculum, provides a great temptation to kids to get off-task, which they do, usually by entertaining themselves with their phones. They get off-task in other ways too — web surfing, doing homework for… Read more →

Teaching Computer Science: When You Need Help, Ask For Help

I’m volunteering a couple mornings a week at a local high school, helping out with computer science classes. It’s a mixed class . . . most of the students are taking AP Computer Science Principles, and about 10 kids just recently started a second-semester Visual Basic class. The VB kids were pretty inquisitive at first but started to get discouraged… Read more →

Teaching Computer Science: Asking for Help

I’m volunteering a couple mornings a week at a local high school, helping out with computer science classes. This morning, in AP Computer Science Principles, the teacher went through an explanation of the hexadecimal number system, then gave an in-class assignment for students to convert their cell phone number to hexadecimal. Not in two parts, 3 digits and 4 digits,… Read more →

Teaching Computer Science: It’s Not Easy to Teach a Subject in Which You Have No Training

A recent issue of Science has an article on the pipeline for computer science teachers . . . The first sentence says, “It’s not easy to teach a subject in which you have no training.” That could be the whole article, really. That’s about all you need to know about the current state of computer science instruction: It’s not easy… Read more →

More Words and Phrases I’m Sick Unto Death Of

Although I can’t claim never to have said these things myself, if I had a dollar for every time I’ve heard someone say either a) “It was working fine 10 minutes ago,” or b) “It works okay on my machine,” I would be comfortably retired by now. Thus spoke The Programmer. Read more →

What Does a Programmer Do?

I was asked to give a talk last week to a high school computer science class on “What Does a Programmer Do?” (I’m indebted to Jim McCarthy for the “lords and ladies of logic” section.)   Programming is problem solving. At the highest level, the problem that programmers solve is that people want to be able to do things with… Read more →

I’m a Winner!

I’ve been doing the daily challenges at CodeFights for quite a while and yesterday’s challenge is the first time I got first place! (CodeFights ranks solutions by fewest number of characters, with solution time as the tiebreaker.) Read more →

AP Computer Science Revisited

I got a LinkedIn invitation today from a student I taught in an AP Computer Science class a couple of years ago. She’s now a computer science major at UCSB. Several of the kids from that class are now in college as computer science majors. Some of them would have been computer science majors anyway, without the class — they… Read more →

Next Page »