Problem Set This Problem Set Contains 7 Questions (A G) Input: Standard Input Output: Standard
Problem Set This Problem Set Contains 7 Questions (A G) Input: Standard Input Output: Standard
GRAPH OF SENTENCES
Input: Standard Input Output: Standard
A sentence can be manipulated to portray a pattern of interesting graph. For example, if the following sentence is given. 1MG 1MC creates awareness among domestic tourists ; The following graph will be plotted. *** *** ******* ********* ***** ******** ******** The number or rows in the graph is equal to the number of words in the sentence. Each row prints an asterisk representing each alphanumeric in the word.
Inp ut
The input consists of several test data. The first line contains the number of test cases. Each line on a test case contains a sentence of not more than 10 words. The sentence must
Output
The graph for each dataset is printed separated with a blank line.
Page 1 of 2
Sample Input
3 The Homestay2U was interesting ; Perlis Permai Lagi Mempersona ; PROMED at UiTM Perlis ;
Page 2 of 2
TRIPLET CHARACTERS
Input: Standard Input Output: Standard
Given a sequence of characters as follows which include the characters M and G only. MMMMGMGMMMMGMMMMMMMGMGMMMGMG GG The possible combinations of M and G characters to create a sequence of 3 characters combinations are MMM, GMM, MGM, MMG, MGG, GMG GGM and GGG. Based on the long sequence of characters as given in the above example, the frequency of the 3characters combinations are 32310001 accordingly. The sequence of the characters will be cut into three
Input
The input consists of several test cases. The first line contains the number of test cases. Each line in a test case contains a sequence of characters. The maximum length of the sequence of characters is 30
Outp ut
For each test case, display the frequency of each of the 3 characters combination. Sample Input Acceptable Output for the Sample Input 3 000000010 GGGGGGGGGGGGGGGGGGGGGGGGGGGG 50000005 GG 10400401 MMMGGGMMMGGGMMMGGGMMMGGGMMM GGG GGGGMGMGMGMGMGMGMGMGMGMGMGM Problem setter: Jamal Othman
Page 1 of 1
The phrase "six degrees of separation" is often used to describe the idea of the "small world" phenomenon, i.e., the world is more closely connected than perhaps we all thought. Several studies have been conducted to empirically measure this connectedness. Watts attempted to study this phenomenon on the internet. Using an email message as the package that needed to be delivered, Watts found that the average degree of separation between the senders and the receivers was around six. If the intermediaries on the internet are viewed as nodes in a graph, then the average shortest path length between arbitrary pairs of nodes in the graph Given a graph in which all nodes can be reached from any starting point, you will find the average shortest path length between arbitrary pairs of nodes. For example, consider the following graph. Note that links are shown as directed edges, since a link from node 1 to node 2 does not imply a link from node 2 to node 1.
The length of the shortest path from node 1 to nodes 2, 3, and 4 is 1, 1 and 2, respectively. From node 2 to nodes 1, 3 and 4, the shortest paths have lengths of 3, 2 and 1. From node 3 to nodes 1, 2 and 4, the shortest paths have lengths of 1, 2 and 3, respectively. Finally, from node 4 to nodes 1, 2 and 3 the shortest paths have lengths of 2, 3 and 1, respectively. The sum of these path lengths is 1 + 1 + 2 + 3 + 2 + 1 + 1 + 2 + 3 + 2 + 3 + 1 = 22. Since there are 4 possible starting
Page 1 of 2
Inp ut
The input consists of several test cases of inter network layouts. The first line contains the number of test cases. Each line in a test case contains a pair of integer numbers x and y, where x > 0 and y > 0 representing a connection from an intermediary numbered x to an intermediary numbered y. The end of each test case will be marked by a line containing x = y = 0. The intermediary labels will always be in the range 1 to 100. The graph will not include selfreferential connections (that is, there will be no direct connections from a node to itself), and at least one path will exist from each node in the graph to every other node in the
Outp ut
For each test case, determine the average degree of separation between the network intermediaries, accurate to two fractional digits. Each test case output starts with the prefix Case n: where n represents the test case identifier
Sample Input
2 1 2 1 3 4 0 1 1 4 2 7 0 2 4 3 1 3 0 2 4 2 7 1 0
Page 2 of 2
D
Inp ut
Given a positive number not divisible by 2 or 5, some multiples of the number produce a sequence of 7s as its result.
The input consists of several test data. The first line contains the number of test cases. Each line on a test case contains a test data x, such that x < 10000 and x is not divisible by 2 or
Outp ut
For each test data x, determine the number of digits in the smallest sequence of 7s produced by a multiple of x. Each test case output starts with the prefix Case n: where n represents the test case identifier (numbered sequentially starting with 1), followed by a single space, and Sample Input Acceptable Output for the Sample Input
3 9 11 9901 Case Case Case Case 1: 2: 3: 4: 3 9 2 12
Page 1 of 1
E
Inp ut
CLOC K
You are given a standard 12hour clock with analog display, an hour hand and a minute hand. How many times does the minute hand pass the hour hand in a given time interval?
The input consists of several test cases. The first line contains the number of test cases. Each line in a test contains four numbers. case The first pair of numbers represents an initial time; the second pair represents a final time. In each such number pair, the first number represents hours, second number represents minutes. The hours will be in the range 1..12, the minutes in the range 0..59. No initial time and no final time will be an instant at which the minute hand just passes the hour hand. (In particular, 12 00 will not occur as an initial or final time.) No initial time will be the same as the corresponding final time. Between each initial time and corresponding final time, the hour hand will have turned less than one full revolution (360 degrees). As the hour hand turns from its initial position to its final position, it may or may not sweep past the number 12 on the clocks dial. o If it does, then either the initial time is an A.M. time and the final time a P.M. time, or vice versa.
Problem E: Clock
Page 1 of 2
Output
Each line of input gives rise to one line of output, containing the initial and final times, and the number of times the minute hand passes the hour hand between the initial time and the final time. Sample Input Acceptable Output for the Sample Input
6 12 50 1 2 3 8 3 20 2 45 11 0 11 0 3 20 1 2 12 50 3 20 3 8 12:50 03:08 02:45 11:00 01:02 03:20 01:02 03:20 11:00 03:20 12:50 03:08 0 1 8 4 11 10
Problem E: Clock
Page 2 of 2
Class Statistics
The new principal of Sekolah Kebangsaan Bistari plans to meet the teaching team to discuss the performance of the classes/teachers and, he wants to prepare himself with some statistics for the meetings. Your task is to write a program that reads the pupils' marks in each class and generates performance reports for the principal prior to the meetings.
Inp ut
The input starts with an integer K (1 < K < 100) indicating the number of classes on a line by itself. Each of the following K lines gives a class's data, which starts with an integer N (2 < N < 50) indicating the number of pupils in the class. The number of pupils is followed by their marks, given as integers, in the range of zero to one hundred, separated
Output
The report for each class consists of two lines. The first line consists of the sentence: "Class X", where X indicates the class number starting with the value of one. The second line reports the maximum class mark, minimum class mark and the largest difference between consecutive marks (when sorted in non decreasing order) in the class using the formats shown in the sample below. Sample Input Acceptable Output for the Sample Input 2 5 30 25 76 23 78 6 25 50 70 99 70 90 Class 1 Max 78, Min 23, Largest gap 46 Class 2 Max 99, Min 25, Largest gap 25 Problem Setter: NMH Adapted from ACMICPC 2011 South
Page 1 of 1