Small Triangles, Large Triangles C
You are given n triangles, specifically, their sides a(i), b(i) and c(i) . Print them in the same style but sorted by their areas from the smallest one to the largest one. It is guaranteed that all the areas are different. Input Format First line of each test file contains a single integer n. n lines follow with , a(i), b(i) and c(i) on each separated by single spaces. Constraints 1 <= n <= 100 1 <= a(i), b(i), c(i) <= 70 a(i) + b(i) > c(i) a(i) + c(i) > b(i)
View Solution →Structuring the Document C
A document is represented as a collection paragraphs, a paragraph is represented as a collection of sentences, a sentence is represented as a collection of words and a word is represented as a collection of lower-case ([a-z]) and upper-case ([A-Z]) English characters. You will convert a raw text document into its component paragraphs, sentences and words. To test your results, queries will ask you to return a specific paragraph, sentence or word as described below. Alicia is studying the C
View Solution →No Idea! Python
There is an array of n integers. There are also 2 disjoint sets, A and B, each containing m integers. You like all the integers in set A and dislike all the integers in set B. Your initial happiness is o. For each i integer in the array, if i belons to A, you add 1 to your happiness. If i belong to B, you add -1 to your happiness. Otherwise, your happiness does not change. Output your final happiness at the end. Note: Since A and B are sets, they have no repeated elements. However, the array
View Solution →Symmetric Difference Python
Task: Given 2 sets of integers, M and N, print their symmetric difference in ascending order. The term symmetric difference indicates those values that exist in either M or N but do not exist in both. Input Format: The first line of input contains an integer, M. The second line contains M space-separated integers. The third line contains an integer, N. The fourth line contains N space-separated integers. Output Format: Output the symmetric difference integers in ascending ord
View Solution →Set.add() Python
If we want to add a single element to an existing set, we can use the .add() operation. It adds the element to the set and returns 'None'. Example >>> s = set('HackerRank') >>> s.add('H') >>> print s set(['a', 'c', 'e', 'H', 'k', 'n', 'r', 'R']) >>> print s.add('HackerRank') None >>> print s set(['a', 'c', 'e', 'HackerRank', 'H', 'k', 'n', 'r', 'R']) Task: Apply your knowledge of the .add() operation to help your friend Rupal. Rupal has a huge collection of country stamp
View Solution →