HackerEarth Problem Solution
link HackerEarth Problem
Will she accept him?
A love Guru determines "whether a guy's proposal is going to be accepted by his crush or not" just by doing some mysterious calculation on their names, but it takes too much time for him. So, he hired you as a programmer and now your task is to write a program that helps the Guru.
He reveals his mystery with you and that is:
If the guy's name is a subsequence of his crush's name, then she is going to accept him, otherwise she will reject him.
Input
First line contains T, the number of test cases.
Next T lines contain two strings S1 and S2 which are the guy's name and his crush's name respectively.
Output
For each test case, according to Guru's mystery, if the crush is going to accept the guy then print "Love you too", otherwise print "We are only friends".
Constraints
strings contain only lowercase Latin letters.
Sample Input
4 kalyan nobodyintheworld rahul allgirlsallhunontheplanet physicsguy nobodynobodylikesitbetter lal llaggyel
Problem
You are given a range . You are required to find the number of integers in the range such that where is equal to the sum of digits of in its hexadecimal (or base 16) representation.
For example, ( in hexadecimal is written as ). You are aksed such questions.
Input format
- The first line contains a positive integer denoting the number of questions that you are asked.
- Each of the next lines contain two integers and denoting the range of questions.
Output Format
For each test case, you are required to print exactly numbers as the output.
Constraints
For the first test-case, numbers which satisfy the criteria specified are : 2,3. Hence, the answer is 2.
For the second test-case, numbers which satisfy the criteria specified are : 5,6,7 and 8. Hence the answer is 4.
For the third test-case, numbers which satisfy the criteria specified are : 7,8,9,10,11 and 12. Hence the answer is 6.
You have rectangles. A rectangle is golden if the ratio of its sides is in between , both inclusive. Your task is to find the number of golden rectangles.
Input format
- First line: Integer denoting the number of rectangles
- Each of the following lines: Two integers denoting the width and height of a rectangle
Output format
- Print the answer in a single line.
Constraints
There are three golden rectangles: (165, 100), (170, 100), (160, 100).
Comments
Post a Comment