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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.5, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.