Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Triples with Properties


Shikhar has two integers S and T. Now, he wants to count al possible triplets of non-negative integers (a, b, c) which satisfy


the below conditions:


-a+b+c<= S -axbxc<=T


Your task is to help him by finding the count of such triplets of non negative integers (a, b, c)


reture cont


T


13 printfomet trip


Input


The only line of input contains two space separated integers S and T


Output


Print the count of triplets of non-pegative integers (a, b, c) satisfying the conditions


Explanation


In the first example, we have $1 and T. O eve 4 triplets of non-negative integers which have the above properties (0,0,0) (0,01), (010) and (100) Therefore, the output is 4


Esc FrLock


2


4


12


4+


Ajith is a raw agent and he is going on a secret mission.He needs your help but you have yo learn how to encode a secret message yo communicate safely with other agents




Cipher with Key





A Keyword Cipher is a monoalpha





uses a key to provide en ption





In a substitution cipher each letter of





matched with a different letter accord to phetet





Using these letter matchings, every letter of the esse





substituted to get the encrypted messag





In a keyword cipher, the key determines the let he ciphertext alphabet is created by keeping the lette the beginning (after removing the repeated letters then the rest of remaining letters are used in aph





For example, if the key is zebras





Plaintext Alphabet: albicidjeifigibili Ciphertext Alphabet : zjelb/r/als/cidition





Notice that with this key, we are able to match each lecer of engl alphabet with a different letter. Using these matchings we can encrypt the word discovered as rpbluacerda





replaced with f,i is replaced with and soon





Given a key K and the message M, encrypt the message Keyword Cipher, using the given key





Input





The first tine contains two

Krishna owns n mobile phones (numbered 1 through n) he wishes to sell all of them in the coming next N years by selling exactly 1 mobile per year. The initial price of each mobile phone is pi . Due to depreciation , the price of each mobile phone decreaes by 2500 rupees per year untill sold.





Note that price of a mobile cannot drop below 1000 rupees no matter how many years have passed , ie when the price of a mobile reaches 1000 rupees in some years , it remains 1000 in all subsequent years .





Find max amount krihna can make by selling his mobile phones





Input




The first line contains a single integer t denoting the number of test cases




The first line of each test case contains a single integer n




The second line of the each test case contains n space seperated integers p1,p2,.....,pn





Output




For each test case , print a single line containing an integer

Evolution stage



If N is even N/2



If N is odd N * 3+1 and point steps to reach 1 . Ex: 10is even 10/2=5, 5 is odd 5*3+1=16, 16 is even 16/2= 8 and 8/2=4 and 4/2= 2 and 2/2 =1



So the output is 6

Discount sale



Input 1


4


1 1 2 2


Output 1


4



Input 2


2


10 200


Output 2


210

krishna owns N mobile phones (numbered 1 through N) He wishes to sell all of them in the coming next N years by selling exactly one mobile per year.

N = 3 

mobile prices = [60000, 60000, 60000]


depreciating 1000rs per every year after selling each mobile 


first year mobile price = 60000

second-year decreasing = 1000 depreciation 



in this way he sold the mobiles could you please resolve my query



The function Power, which raises the integer number x to the power n, can be defined recursively as follows:

Power(x, n) = 1 for n = 0

Power(x, n) = x * Power(x, n-1) for n > 0

(i) Using the above definition write the recursive function Power(x, n) in C.

(ii) Rewrite the recursive function Power(x, n) in an iterative form.

(iii) Write the main function and test the above-written functions. Note: You can write one program and test the functions or you may write two separate programs for each part (i) and (ii). 


Python Program


Write a program to print the following, Given a word W and pattern P, you need to check whether the pattern matches the given word.The word will only contain letters(can be Uppercase and Lowercase). The pattern can contain letters, ? and *.


? : Can be matched with any single letter.

* : Can be matched with any sequence of letters (including an empty sequence).


If the pattern matches with the given word, print True else False.


Sample Input1

3

Hello *l?

Hell He?ll

Hell ?*

Sample Output1

True

False

True


Sample Input1

3

Hello Hell*

Hell He*ll

Hell hell*

Sample Output1

True

True

False


An election is contested by five candidates. The candidates are numbered 1 to 5 and a voting is done by marking the candidate number in a ballot paper. Write a C++ program to read the ballot and count the votes cast for each candidate using an array variable count. In case, a number read is outside the range 1 to 5 the ballot should be considered as a 'spoilt ballot', and the program should also count the number of spoilt ballots

LATEST TUTORIALS
APPROVED BY CLIENTS