ACCA PROGRAMMING CONTEST February 10, Problem #1 SIMPLE WORD FINDER Advanced

Similar documents
PLU February 2014 Programming Contest. Novice Problems

Math Circles 9 / 10 Contest Preparation I

n r for the number. (n r)!r!

Roll & Make. Represent It a Different Way. Show Your Number as a Number Bond. Show Your Number on a Number Line. Show Your Number as a Strip Diagram

Question Score Max Cover Total 149

Classroom Activities Teacher s Guide

Pre-Test Unit 7: Real Numbers KEY

Lecture 2: Data Representation

2. Tell your partner to examine the cards, and give you the cards on which the number

MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability. Preliminary Concepts, Formulas, and Terminology

Fun Challenges Problem Solving Reasoning Deductive Thinking Convergent/Divergent Thinking Mind-Bending Challenges Critical Thinking

Get Ready to WRITE! If you could write a story about anything, what would you writeeeeee about?eee

This assignment will be due on Tuesday, September 30, 2014 at the beginning of the period.

The Go Write! Pre-writing pack for level 1-2

Math 1111 Math Exam Study Guide

Lesson 21: If-Then Moves with Integer Number Cards

Pascal Contest (Grade 9) Wednesday, February 23, 2005

How Close Can You Get?

CSCI 2200 Foundations of Computer Science (FoCS) Solutions for Homework 7

100 IDEAS FOR USING A HUNDRED SQUARE

Problem A. Worst Locations

Problem Set 2. Counting

2016 CCSC Eastern Conference Programming Competition

Math 4610, Problems to be Worked in Class

Make Math Meaningful!

Additional Practice. Name Date Class

Objective: Solve word problems involving different combinations of coins with the same total value.

Math 3012 Applied Combinatorics Lecture 2

Wigan LEA Numeracy Centre Year 5 Block 3 Assessment

Objective: Solve word problems involving different combinations of coins with the same total value.

Final Exam, Math 6105

1. Completing Sequences

Math 1111 Math Exam Study Guide

Due Friday February 17th before noon in the TA drop box, basement, AP&M. HOMEWORK 3 : HAND IN ONLY QUESTIONS: 2, 4, 8, 11, 13, 15, 21, 24, 27

Philadelphia Classic 2013 Hosted by the Dining Philosophers University of Pennsylvania

Definition 1 (Game). For us, a game will be any series of alternating moves between two players where one player must win.

Hundreds Grid. MathShop: Hundreds Grid

Pre-Algebra Sponsored by the Indiana Council of Teachers of Mathematics. Indiana State Mathematics Contest

ECE 499/599 Data Compression/Information Theory Spring 06. Dr. Thinh Nguyen. Homework 2 Due 04/27/06 at the beginning of the class

GROUP ROUND INSTRUCTIONS

Canadian Math Kangaroo Contest

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague 7 November, CS1800 Discrete Structures Midterm Version C

COMPOSITION CRAM INSTRUCTIONS:

ACM Collegiate Programming Contest 2016 (Hong Kong)

Mathematical Magic Tricks

2008 ACM ICPC Southeast USA Regional Programming Contest. 25 October, 2008 PROBLEMS

It is important that you show your work. The total value of this test is 220 points.

Sheet 1: Introduction to prime numbers.

Lecture5: Lossless Compression Techniques

Divisibility. Igor Zelenko. SEE Math, August 13-14, 2012

Lesson 5: Understanding Subtraction of Integers and Other Rational Numbers

The study of probability is concerned with the likelihood of events occurring. Many situations can be analyzed using a simplified model of probability

Maths Quiz. Make your own Mental Maths Game

St Thomas of Canterbury Catholic Primary School Where every child is special

Printing: You may print to the printer at any time during the test.

2008 High School Math Contest Draft #3

! Denver, CO! Demystifying Computing with Magic, continued

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

Eleventh Annual Ohio Wesleyan University Programming Contest April 1, 2017 Rules: 1. There are six questions to be completed in four hours. 2.

Multiplying and Dividing Integers

keyboard workshop Silent Night Bars 1-8 (Intro) Fill-in D7 / / C / / G7 / / C / / C / /

ShillerMath Book 1 Test Answers

Unit 2: Algorithm Development. Flowcharts

COCI 2008/2009 Contest #2, 15 th November 2008 TASK KORNISLAV RESETO PERKET SVADA SETNJA CAVLI

Module 3 Greedy Strategy

2018 State Math Contest Wake Technical Community College. It was well known that each suspect told exactly one lie. Which suspect did it?

Year 4 optional SAT mark scheme paper A

CMPUT 396 Tic-Tac-Toe Game

2016 Canadian Computing Olympiad Day 2, Problem 1 O Canada

DISCUSSION #8 FRIDAY MAY 25 TH Sophie Engle (Teacher Assistant) ECS20: Discrete Mathematics

Helping your child with Maths at the end of Reception and in Year 1

Columbus High School Middle School Math Tournament

CSE 573 Problem Set 1. Answers on 10/17/08

Problem A Rearranging a Sequence

D1 Probability of One Event

13 Searching for Pattern

BOOM! subtract 15. add 3. multiply by 10% round to. nearest integer. START: multiply by 2. multiply by 4. subtract 35. divide by 2

Math is Cool Masters

MAT 17: Introduction to Mathematics Final Exam Review Packet. B. Use the following definitions to write the indicated set for each exercise below:

The Teachers Circle Mar. 20, 2012 HOW TO GAMBLE IF YOU MUST (I ll bet you $5 that if you give me $10, I ll give you $20.)

In how many ways can we paint 6 rooms, choosing from 15 available colors? What if we want all rooms painted with different colors?

4th Pui Ching Invitational Mathematics Competition. Final Event (Secondary 1)

Pi Day Mathematics Competition. Final Round 2017

Pascal Contest (Grade 9)

JIGSAW ACTIVITY, TASK # Make sure your answer in written in the correct order. Highest powers of x should come first, down to the lowest powers.

One Centimeter Grid Paper

American Mathematics Competitions. Practice 8 AMC 8

10.13 Sample A.G.E. program

Probability. March 06, J. Boulton MDM 4U1. P(A) = n(a) n(s) Introductory Probability

Discrete Structures for Computer Science

Objective: the student will gain speed and accuracy in letter recognition.

b. How would you model your equation on a number line to show your answer?

A1 Problem Statement Unit Pricing

Chapter 5 Backtracking. The Backtracking Technique The n-queens Problem The Sum-of-Subsets Problem Graph Coloring The 0-1 Knapsack Problem

2. Nine points are distributed around a circle in such a way that when all ( )

A C E. Answers Investigation 1. Applications. b. No; 6 18 = b. n = 12 c. n = 12 d. n = 20 e. n = 3

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates

CSC/MTH 231 Discrete Structures II Spring, Homework 5

Binary Continued! November 27, 2013

Classwork Example 1: Exploring Subtraction with the Integer Game

Transcription:

Problem #1 SIMPLE WORD FINDER prob1.cpp if C++ prob1.pas if Pascal This problem asks you to read in one line of data from a user. The line will be a complete sentence. Your program should then prompt the user for a single word. The user will enter the word in lower case letters. Your program must determine if the single word is found in the sentence. You must exclude all capitalization, white space and punctuation from the sentence. The user may use two special characters as wild cards in their word. A? may be used as a single character place holder. If a? is used then any character may be used in its place (except no character). A * may be used as a place holder for any number of characters, including no character. The * symbol may not be used to start or end a word. Print to the screen whether the word was found. Keep asking a user for a word until they enter 0. Do not worry about whether the result is a real word. Here are some examples: INPUT: Your program accepts a single sentence from the user. It accepts a single word until the user enters 0. OUTPUT: Your output should print to the screen whether the word was found. EXAMPLE: Enter a sentence: The cat in the hat sat on Fred s mat. Enter a word (enter 0 when done): mat Yes, mat is in the sentence. Enter a word (enter 0 when done): t?n Yes, ton is in the sentence. Yes, tin is in the sentence. Enter a word (enter 0 when done): s*t Yes, sat is in the sentence. Yes, smat is in the sentence. Enter a word (enter 0 when done): freds Yes, freds is in the sentence. Enter a word (enter 0 when done): 0

Problem #2 DICE COMBOS prob2.cpp if C++ prob2.pas if Pascal Your program must determine how many different ways x dice can be thrown to get the number n? Your program must allow for any short integer value of x or n. INPUT: A value for x and a value for n. OUTPUT: Show all combinations using all dice whose sum is n. EXAMPLE: Please enter the number of dice used: 3 Please enter the value for the sum: 6 Result is: (1,1,4) (1,2,3) (1,3,2) (1,4,1) (2,1,3) (2,3,1) (2,2,2) (3,2,1) (3,1,2) (4,1,1)

ACCA Programming Contest February 10, 2001 Problem #3 A VERY PECULIAR SEQUENCE prob3.cpp if C++ prob3.pas if Pascal Examine the following sequence of 10 numbers. 1 11 21 1112 3112 211213 312213 212223 114213 31121314 41123214 This sequence is generated using the following algorithm. 1. Start with any integer. (In this case the start number is 1.) 2. Each number in the sequence is formed from the previous by counting the number of like digits and placing them in order: count digit count digit count digit for all counts which are non-zero in digit order. For example, 1 consists one 1; therefore, the next number in the sequence is 11. 11 consists of two 1's; therefore, the next number in the sequence is 21. 21 consists of one 1 and one 2, therefore; the next number in the sequence is 1112. And so on. The purpose of this program is to generate the first 10 numbers in a sequence beginning with any start integer. INPUT: OUTPUT: Your program should prompt for the start integer. Your output will be the first ten terms of the sequence, each on a different line. EXAMPLE: Enter number: 32 32 1213 211213 312213 212223 114213 31121314 41122314 31221324 21322314

Problem #4 MAGIC CARDS prob4.cpp if C++ prob4.pas if Pascal A set of magic cards can be used to play a fun guessing game. Assume the following cards exist. CARD 1 CARD 2 1 3 5 7 2 3 6 7 9 11 13 15 10 11 14 15 17 19 21 23 18 19 22 23 25 27 29 31 26 27 30 31 CARD 3 CARD 4 4 5 6 7 8 9 10 11 12 13 14 15 12 13 14 15 20 21 22 23 24 25 26 27 28 29 30 31 28 29 30 31 CARD 5 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 If you ask a friend to pick any number from 1-31 and then have your friend list the cards the number appears on, you can guess the number. Let's say your friend picks 22. They tell you that the number appears on cards 2, 3, and 5. You can easily determine the number by adding up the digits on the upper left-hand side of those cards. A 2 is on card 2, a 4 is on card 3 and a 16 is on card 5. Therefore the number they picked is 2+4+16 = 22. This game is based on the binary number system. To determine which numbers appear on each card, you need to convert each number to their binary representation. Working right to left every number that has the 0th bit turned on is found on card 1. Every number that has the 1st bit on is found on card 2. This continues for each bit. So, for example, a 13 in binary is 1101. You will find 13 on cards 1, 3 and 4. You can create any number of magic cards. INPUT: Prompt a user to enter the card they wish to display. OUTPUT: Display on the screen the card the user requested. EXAMPLE: Please enter magic card number: 4 Card number 4 is: 8 9 10 11 12 13 14 15 24 25 26 27 28 29 30 31

Problem #5 PATHFINDER prob5.cpp if C++ prob5.pas if Pascal This program will determine the path in a maze. A path must be determined using the first cell as the starting position. The exit position may be different for each maze given. Determine the sequence of the maze from the cell numbered 1 to the exit cell. A number may not be repeated in the solution and not all numbers need to be used. INPUT: Number of cells in the maze. A line of input for each cell. This line will contain the cell position to the left, straight and right of the current cell. A 0 will be used to represent the absence of a cell. The last line of input is the number of the exit cell. For example, if the user enters 5 4 0 for cell 2 then from position 2: going left will move you to position 5 going straight will move you to position 4 going right will move you to a dead end OUTPUT: The path from cell 1 to the exit cell. EXAMPLE: Input number of cells: 7 Enter cell to the left, straight and right of cell 1: 0 2 3 Enter cell to the left, straight and right of cell 2: 5 4 0 Enter cell to the left, straight and right of cell 3: 1 0 0 Enter cell to the left, straight and right of cell 4: 0 0 0 Enter cell to the left, straight and right of cell 5: 6 0 2 Enter cell to the left, straight and right of cell 6: 7 0 5 Enter cell to the left, straight and right of cell 7: 0 0 6 Enter exiting cell: 7 The path from cell 1 to cell 7 is: 1 2 5 6 7 Here is another example. Input number of cells: 6 Enter cell to the left, straight and right of cell 1: 2 4 3 Enter cell to the left, straight and right of cell 2: 0 0 1 Enter cell to the left, straight and right of cell 3: 1 0 6 Enter cell to the left, straight and right of cell 4: 0 5 0 Enter cell to the left, straight and right of cell 5: 0 0 0 Enter cell to the left, straight and right of cell 6: 3 0 0 Enter exiting cell: 5 The path from cell 1 to cell 5 is: 1 4 5 Assume at most 15 cells.

ACCA Programming Contest February 10, 2001 Problem #6 REMAINING DIGITS prob6.cpp if C++ prob6.pas if Pascal The number 1415161718192021222324 consists of 22 digits, and was arrived at by placing the numbers from 14 to 24 one after the other. If I now remove 10 of the digits in such a way that the resulting number is the greatest possible, what are the first 5 digits of the 12 digit number that remains. Of course, the answer for this problem is: 89202. The purpose of this program is to solve this problem for any number created from two two-digit integers and the number of digits to remove. You will then output the first 5 digits of the largest number remaining after removing the digits. INPUT: OUTPUT: Your program should accept three integer values using suitable prompts such that the first two integers entered represent the first and last integers of the number and the third integer represents the number of digits to remove. Your output should appear as follows: The first 5 digits of the resulting number: XXXXX EXAMPLE: Enter first number: 14 Enter second number: 24 Enter the number of digits to remove: 10 The first 5 digits of the resulting number: 89202