All submissions for this problem are available.
A chef at a cake shop only caters to hackers and receives his order in a special format.There are 3 columns - item code, quantity and total price. But, in the quantity column of the order, instead of the real quantity a binary number is written. The real quantity can be obtained by multiplying the decimal equivalent of the binary by 2^y (where y was the secret known only to the chef and his costumers) and converting the decimal so obtained again into binary and treating this binary as the quantity. Total price is obtained by multiplying real quantity with price of one unit.
The chef wants you to create a program for him which takes in the item code, binary code and returns the required no of cakes and the total value(price) of the order. Unfortunately, the chef does not remember the secret code 'y' anymore but has a receipt of the last order that was made and the number of cakes he delivered. He gives it to you in return for the program you are going to make for him.(Assume all items in the shop are of the same value).
Item Code Quantity(binary code) Total Price 1 1000 689000 number of actual cakes delivered-10^6
First line contains 'T', the no of test cases. Each test case is given on two lines, which contain the Quantity binary code 'Q' and Item Code 'I' respectively.
For Each Test Case, output the number of cakes to be delivered in the first line and the total price(value of the order) in the next line.(please remove the decimal in the price)
- 1 ≤ T ≤ 17000
- 1 ≤ I ≤ 2000
- 1 ≤ length of Q ≤ 10
Input: 1 1000 1 Output: 1000000 689000
|Time Limit:||0.085 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.