{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

FSU_ACM_Spring_2009_Programming_Contest

# FSU_ACM_Spring_2009_Programming_Contest - FSU ACM...

This preview shows pages 1–4. Sign up to view the full content.

FSU ACM Programming Contest Spring 2009 Welcome to the FSU ACM Programming contest for Spring 2009. There are 8 questions in this programming contest. Your program should read from the standard input and write to standard output. Programming languages allowed are C/C++ Java Python Perl A problem is solved when it is accepted by the judges. The judges are solely responsible for accepting or rejecting submitted runs. Your program should termi- nate within 40 seconds, for any reasonable size input. Problem Contributors: Zhenhai Duan, Piyush Kumar, Ann Ford Tyson, Gary Tyson, Andy Wang, Zhenghao Zhang. Judges: Peter Gavin, Chris Meyers, Andy Wang Organizers: Peter Gavin, Paul West, Monika Achury, Piyush Kumar

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Problem 1: In mathematics, the Fibonacci numbers are the following sequence of numbers: 0 , 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , .... The first two Fibonacci numbers are 0 and 1, and each remaining number is the sum of the previous two: 0 + 1 = 1 (1) 1 + 1 = 2 (2) 1 + 2 = 3 (3) 2 + 3 = 5 (4) 3 + 5 = 8 (5) 5 + 8 = 13 (6) . . . (7) In mathematical terms, the sequence F n of Fibonacci numbers is defined by the recurrence relation F n = F n - 1 + F n - 2 , with seed values F 0 = 0 and F 1 = 1 . Given a number n , its easy to calculate sum of all odd terms of the Fibonacci sequence upto the n -th term: F 1 + F 3 + ... + F n (Assume that n is always odd). In this problem you are given an input of numbers ending with - 1. The input should be read from stdin . You need to output the sum of all odd terms of the fibonacci sequence for each input n . Assume n 30. Example Input: 3 5 -1 Output: 3 8 -1
Problem 2: Your task is to write a program which determines if word pairs given in an input are anagrams of one another. Anagrams are words which contain exactly the same letters in the same frequency, but in a different order. Example: the word read and the word dare are anagrams. The input data will contain one line of data for each pair of words to be analyzed, with a single blank between the two words. For example, if the input contained 5 word pairs, it might look like read dare stake takes tofu tofu pumpkin pear one two The first two word-pairs are anagrams, the last three pairs are not. You may assume that: the input contains at least one word-pair, that each line contains two valid English words consisting of only lower case letters and that a word will contain no more than 20 characters. You may assume all data provided is valid and that you do not have to do any bad data checking on this problem.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}