Using alphametics in introductory programming classes
暂无分享,去创建一个
An alphametic is an arithmetic problem where the digits are replaced by letters. Furthermore, after the digits are replaced, the problem should contain a message. For example, the following problem appeared in volume 32(2) of Journal of Recreational Mathematics
STEEL + BELTED = RADIALS
and has the solution 87336 + 936732 = 1024068. The problem is that you are given the alphametic in textual form and you are to determine the digits. This type of problem lends itself to solution using a computer program that contains a series of properly nested loops and ifs. I have used alphametics as a basic problem in my introductory programming classes many times and have found them to be an excellent programming assignment. The purpose of this talk is to demonstrate the fundamental approach to a computer solution of this class of problem.