1. Home
  2. »
  3. ZZ-Old-Archived-Posts
  4. »
  5. ITantz.com : April 2017...
List of all Contests for

ITantz.com : April 2017 Python/C Programming Contest

Organisation : ITantz.com
Contest Name : April 2017 Python/C Programming Contest
Contest Last Date : April 30th 2017

Sponsored Links:
Want to comment on this post?
Go to bottom of this page.

Website : itantz.com

Python (or) C Programming Contest:

April 2017 programming contest Ends in April 30th 2017

Related: Oracle OpenWorld India 2017 : www.contest.net.in/21770.html

Problem Statement:
A sequence of n > 0 integers is called a “Happy Numbers” if the absolute values of the differences between successive elements take on all possible values 1 through n – 1. For instance,

1423

is a Happy Number, because the absolute differences are 3, 2, and 1, respectively. The definition implies that any sequence of a single integer is a Happy Number. Write a python or C program to determine whether each of a number of sequences is a Happy number.

Input:
Each line of input contains an integer n < 3, 000 followed by n integers representing the sequence.

Output:
For each line of input generate a line of output saying “Happy” or “Not Happy”. Sample Input

4 1423
5 142-16

Sample Output:
Happy
Not Happy

Last Date to submit your Answer : 30.04.2017

Contest # 1 – Blogger language :
Write a program in c/c++/Java/Python for the following problem.
Problem :
Benjamin’s granddaughter Brenda has a blog where she posts articles about school, friends and other life issues. Intrigued by her opinions, Benjamin tried to read it, but very soon he realized it was too hard to read because of Brenda’s writing quirks.

Brenda writes without spaces or punctuation marks, and moreover, she uses lower and uppercase letters in a liberal and strange way. For example, one of her posts is “PrOgRAMmINgiSgrEAt”. Benjamin has trouble noticing the words “programming”, “is” and “great” when they are written in this way.

To improve his understanding Benjamin decided to do the following: he will first choose a particular string T and a blog post he is interested in; then he will select a contiguous substring of the post and search for T within the substring, in a case-insensitive way; for each occurrence of T within the substring, he will calculate the number of case mismatches, and finally he will obtain the maximum among all these values.

For example, if Benjamin chooses “GR” as T and then selects the substring “PrOgRAM”, he would find a single occurrence “gR” for which the number of case mismatches is 1.

For the same substring, if “r” was chosen as T , he would have found two occurrences, “r” with 0 mismatches and “R” with 1 mismatch, so the maximum number of mismatches would be 1. To complicate things further, Brenda included in the blog a script that, after operating with a substring selection, flips the case of all the selected letters.

This means that after selecting “PrOgRAM” and proceeding as explained above, the sample post would read “pRoGrammINgiSgrEAt”. If Benjamin selects “ammINgi” as a second substring, after calculating his result the post would be left as “pRoGrAMMinGISgrEAt”, accumulating both flips.

You will be given the string T and the original text of the blog post chosen by Benjamin. You will also be given a list of substring selections Benjamin made, in the order he made them.

You need to calculate, for each selection, the maximum number of case mismatches of the occurrences of T in the selected part, considering all the case flips made by previous selections. Notice that the flipping of the case occurs after calculating the result for each selection.

Sponsored Links:

Leave a Reply

How to add comment : 1) Type your comment below. 2) Type your name. 3) Post comment.

www.contest.net.in © 2022

Contact Us   Privacy Policy   Site Map