Professional Documents
Culture Documents
You are playing a game called Innohit ; In which you are given a ball to hit a goal for a valid hit you
get coins ; for first valid hit you get 1; for every consecutive valid hits you win one extra coin from
previous one;
your task is to calculate what the maximum no. of coin you can win in n trails;
Input format:
first line t (1<= t <= 2*10^4) - no. of test cases.
For each test case there is n (1<=n<=10^8) which no of trails
Output:
print maximum for of coin he can win in n trails
1
10
28
55
3
P2
You are playing a game, called InnoCraft; In which you have to make K magical wands made by using
obsidian and iron rod.
There are instructions to a make magicial wand:
1. One magical wand can be formed by one iron rod and one obsidian.
2: You know a magical spell by which you can do following operations:
1. You can convert 1 iron rod to x iron rod
2. You can convert y iron rod to 1 obsidian
In one spell you can perform one of these operation.
Intially you have one iron rod you have make k magical wands.
Your task is to find minimum no. spell you have to perform to make k magical wands.
Input format :
first line t (1<= t <= 2*10^4) - no. of test cases.
The only line of the test case contains three integers x, y and k (2≤x≤10^9; 1≤y,k≤10^9) - no. iron
wonds you can convert from one iron rod,the no of iron rod required to convert in one obsidian, no. of
magical wands you have to form;
Output:
You have to print no. of spells required to form k magical wands for each test case;
Sample Test case;
Input:
3
327
15 6 24
40 19 23
OutPut:
17
36
35
P2
You are playing a game called InnoWord in which you provide with two string contains lowercase
letters s1,s2;
you have to form string to s2 from s1 by s1 appending multiple times , you can erase any character
from string obtained by appending s1;
You task is find what is minimum no. of time you have to append string s1 to get s2;
eg:
s1=”abcd”
s2=”dabc”
if you append s1 two times string becomes “abcdabcd” if erase “abc” from starting and “d” from end
you get strign “dabc” hence in two append you find the s2;
So, you have print 2; if it is impossible to do print -1;
Input format:
s1 (1<=len(s1)<=10^4)
s2 (1<=len(s2)<=10^6)
Output:
Print no. of times you have append string s1 to get s2 by using above instructions;
-1
test case 2:
abcd
dabc
2
P4