Save your cats Time limit 8000 ms Memory limit 131072 kB Problem Description Nicholas Y. Alford was a cat lover. He had a garden in a village and kept many cats in his garden. The cats were so cute that people in the village also loved them. One day,…
Nicholas Y. Alford was a cat lover. He had a garden in a village and kept many cats in his garden. The cats were so cute that people in the village also loved them. One day, an evil witch visited the village. She envied the cats for being loved by ev…
Prime Number Time limit 1000 ms Memory limit 131072 kB Problem Description Write a program which reads an integer n and prints the number of prime numbers which are less than or equal to n. A prime number is a natural number which has exactly two dis…
GCD and LCM Time limit 1000 ms Memory limit 131072 kB Problem Description Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. Input Input consists of several data sets. Each data set…
Marked Ancestor Time limit 8000 ms Memory limit 131072 kB Problem Description You are given a tree T that consists of N nodes. Each node is numbered from 1 to N, and node 1 is always the root node of T. Consider the following two operations on T: M v…