CRAZYSK - Crazy Shopkeeper
Zoglu Bepari is a peculiar shopkeeper of Chittagong. He is a very famous shopkeeper. Everyone loves him and gave him a nick name ‘MAMU’. He has a beautiful small shop which is also known as “MAMUR DOKAN”. From morning to late night, he sells non-stop. His shop always remains over-crowded as he gives some weird and crazy offers almost every day. Most of the offers favor Customers. He recently created a special offer for his customers. For each item he sells, he gives a special card. These cards are rare and only available in his shop. And no one can cheat with him showing fake cards as he is really good at checking cards. Suppose, a Customer bought X items, he gives a positive number N along with X cards to the customer. Another important thing is Customers can return N cards for collecting another item of same type and a card in exchange.
Now as a programmer, you just have to calculate the total number of items a customer can get after using maximum number of cards he gets.
input starts with an positive integer T<100 followed by T lines. Each of these lines contain two positive integers, Number of item (X) bought in the first deal 1<X<=2^64, and number(N) that is given by Mamu 1<N<=X .
Print the total number of items the customer will have after exchanging maximum no of cards for getting extra items.
6 lines code in python , got 4 WAs in C++ probably due to overflow
very simple logic :)
I got confused by description, so if anyone else did as well, here's what it says:
50th A.C :) simple math
5 lines in Python
Use Biginteger to store n and x
WA IN C++...
NAVNEET GUPTA :
My first java solution... :)
the constraint X<=2^64 made the question a little bit tougher.
not a single AC solution in C!!!!why is that??unfair for C users...had to use java for thisLast edit: 2013-12-27 17:09:50
|Added by:||ওয়াসী (Wasi)|
|Cluster:||Cube (Intel G860)|
|Languages:||ADA95 ASM32 GAWK BASH BF C CSHARP CPP C++ 4.3.2 C99 CLPS CLOJURE LISP clisp LISP sbcl D ERL FSHARP FORTRAN GO HASK ICON ICK JAVA JS-RHINO LUA NEM NICE NODEJS OCAML PAS-GPC PAS-FPC PDF PERL PERL6 PHP PIKE PS PRLG-swi PYTHON PYTHON3 PY_NBC RUBY|