You are on page 1of 2

1.

Problem Statement: Milk Man and His Bottles


A Milkman serves milk in packaged bottles of varied sizes. The possible size of the bottles are
{1, 5, 7 and 10} litres. He wants to supply desired quantity using as less bottles as possible
irrespective of the size. Your objective is to help him find the minimum number of bottles required
to supply the given demand of milk.
Input Format:
First line contains number of test cases N
Next N lines, each contain a positive integer Li which corresponds to the demand of milk.
Output Format:
For each input Li, print the minimum number of bottles required to fulfill the demand
Constraints:
1 <= N <= 1000
Li> 0
1 <= i <= N
Sample Input and Output
Input Output
2
17 2
65 7

Explanation:
Number of test cases is 2
In first test case, demand of milk is 17 litres which can be supplied using minimum of 2 bottles as
follows
1 x 10 litres and
1 x 7 litres
In second test case, demand of milk is 65 litres which can be supplied using minimum of 7 bottles
as follows
6 x 10 litres and
1 x 5 litres

2. Problem Statement
The Caesar cipher is a type of substitution cipher in which each alphabet in the plaintext or
messages is shifted by a number of places down the alphabet.
For example, with a shift of 1, P would be replaced by Q, Q would become R, and so on. To pass
an encrypted message from one person to another, it is first necessary that both parties have the
‘Key’ for the cipher, so that the sender may encrypt and the receiver may decrypt it. Key is the
number of OFFSET to shift the cipher alphabet. Key can have basic shifts from 1 to 25 positions
as there are 26 total alphabets. As we are designing custom Caesar Cipher, in addition to alphabets,
we are considering numeric digits from 0 to 9. Digits can also be shifted by key places. For
Example, if a given plain text contains any digit with values 5 and key =2, then 5 will be replaced
by 7, “-” (minus sign) will remain as it is. Key value less than 0 should result into “INVALID
INPUT”
Example 1:
Enter your PlainText: All the best
Enter the Key: 1
The encrypted Text is: Bmm uif Cftu
Write a function CustomCaesarCipher (int key, String message) which will accept plaintext and
key as input parameters and returns its cipher text as output.
3. Implement a program to find the sum of all prime numbers except the smallest one in the given
array.
Sample Input: {2, 9, 17, 65, 13, 3, 19}
Sample Output: 49

4. Implement a program to print the sum of all non-prime index number in an array.
Sample Input: {1, 2, 3, 7, 8, 9, 4, 5, 6}
Sample Output: 21

You might also like