Input: The first line contains a positive integer n indicating how many

advertisement
The 6th National Information Technology Competition for School Students
Problem (1): Unique set of factors
Given a positive integer number, print a unique set of the prime factors for
the number. For example, the number 24 has factors: 2 X 2 X 2 X 3; hence, your
program should print: 2 and 3 only.
Input:
The first line contains a positive integer n indicating how many
instances of the problem are subsequently described. Each such instance is
described on a single line by a a number.
Output:
For each instance of the problem given as input, display the number
and its prime factors without repetition..
Sample Input
3
99
24
210
Resultant Output
99: 3 11
24: 2 3
210: 2 3 5 7
The 6th National Information Technology Competition for School Students
Problem (2): New Line
Liny is good in typing, however, after he finished typing a paragraph he found
out that his new line key (Enter key) does not work. You are requested to help
Liny to add a new line after each sentence. The end of a sentence is marked by
a full stop, question mark, or exclamation mark.
Input:
The first line contains a positive integer n indicating how many
instances of the problem are subsequently described. Each such instance is
described on a single line paragraph(no new lines).
Output:
For each instance of the problem given as input, display the
paragraph by printing each sentence along its number in separate line.
Sample Input
1
I’m Liny. I type very fast and you
cannot compete with me. However, I
got unlucky and my paragraph got
corrupted because my new line key
is not working! Please help Liny
overcome his new line problem. Can
you do so?
Resultant Output
(1) I’m Liny.
(2) I type very fast and you cannot
compete with me.
(3) However, I got unlucky and my
paragraph got corrupted because my
new line key is not working!
(4) Please help Liny overcome his
new line problem.
(5) Can you do so?
The 6th National Information Technology Competition for School Students
Problem (3): Collinear Points
Given n points in 2 dimensional space, identify whether the points are collinear
or not. For example, points in the left hand side of the figure below are
collinear while the points in the right hand side are not.
Collinear
Non-Collinear
Input:
The first line contains a positive integer n indicating how many
instances of the problem are subsequently described. Each such instance
described on a single line by 2N+1 numbers. The first number is the number of
points N, and the remaining 2N numbers are the coordinates of point.
Output:
For each instance of the problem given as input, display either yes
if the points are collinear or not otherwise.
Sample Input
2
3 1 2 3 3 5 4
3 1 1 3 3 4 3
Resultant Output
Yes
No
The 6th National Information Technology Competition for School Students
Problem (4): Polynomial Helper
Poly is a smart students who likes polynomials and their derivatives. However,
from time to time he needs to take a break from the pencil and paper calculations
and seek computer help to calculate the value of a function along with the value
of a derivative for specific point. Can you help Poly.
Input:
The first line contains a positive integer n indicating how many
instances of the problem are subsequently described. Each such instance is
described on a single line by a sequence of numbers space separated. The
first number of the sequence is the length of the sequence
Output:
For each instance of the problem given as input, display on a single
line the words Sorted or Not Sorted.
Sample input:
-----------5
5 4 8 12 33 33
3 4 4 8
6 4 8 12 12 11 20
5 44 13 11 10 3
1 4
Resultant output:
---------------Sorted
Sorted
Not Sorted
Not Sorted
Sorted
The 6th National Information Technology Competition for School Students
Problem (5): Strange Numbers
We define "strange" numbers in the following way:1) All strange numbers have
at least one prime digit 2) The total of even digits is greater than the
total of odd digits.
Input:
The first line contains a positive integer n indicating how many
numbers to be checked whether it is strange or not. The next line contains n
numbers separated by new line.
Output:
For each instance of the problem given as input, display on a single
line the words Strange or Not Strange.
Sample Input
6
2
5
78
23
3338881
939392
Resultant Output
2 is strange
5 is Not strange
87 is strange
23 is Not strange
3338881 is strange
939392 is Not strange
Download