spoj#ADITYA13. FizzBuzz Happy 2013
FizzBuzz Happy 2013
Having cleared the ACM ICPC online round you receive a job offer of teaching JAVA programming to High School Students of Byteland. You gladly take the job offer and after a few days of teaching you give the students a program to write. You ask them to write a FIZZBUZZ program. They are either too smart or too lazy. They argue that it is too difficult and callenge you to do better than that without using any english alphabets. You consult senior programmer Mitch who suggests you a way out of the problem. "Do it in BF," he says. Tjandra suggests you do it in Whitespace.
Input
Two space separated one digit integers A and B.Then a newline.Then a strings C of maximum length 5 followed by a newline. Then another string D of max length 5 followed by a newline. It is guaranteed that gcd(A,B)<A and gcd(A,B)<B. Also the strings comprise only alphanumeric characters
Output
For all numbers in the set [1,99] print C if the number is divisible by A, print D if divisible by D, print C concat D if divisible by both and the number (with preceding zeroes if required) if it divisible by neither A nor B.
Example
Input: 2 3
Happy
2013</p>Output: 01
Happy
2013
Happy
05
Happy2013
07
..........and you get the idea
Wishing all of you a HAPPY NEW YEAR 2013......:)
Edit: 05-01-2013
I am giving you all a link to mostafa_36a2's solution. You would be pleased....
Download the encrypted text solution