bOt cOde - Round 1

7 replies [Last post]
bOtskOOl
Offline
Last seen: 10 years 3 weeks ago
Joined: 2009-02-21
bOt Points: 3500

 

 

These are the problems for round 1

 

The last time for submission is 

 

15 June 2009

12 : 00  midnight 

 

all submissions to be mailed to

[email protected] 

 

bOtskOOl
Offline
Last seen: 10 years 3 weeks ago
Joined: 2009-02-21
bOt Points: 3500
Floppies

Problem 1 -   (50-80 points)

 

Floppies

In this age of Internet, on-line connections, instantaneous email etc., there are still some of the unhappy few who need to work with floppy disks. John is one of those. Every evening he goes home and wants to continue what he was doing at work on his private UNIX system. Thus, every night he considers the files he needs, and then puts them on one or more floppy disks.

For this, he has developed the following procedure:

First, put all the files in one big SHAR file.

Then compress the file.

Next, uuencode it, such that it is split in nice lines of 62 characters each (including the newline).

Then, split it in files of 30,000 lines each (so that it is about 1.86 Mb).

Then compress each of the files and put it on a floppy by itself.

This procedure so far always worked, since 1.86 of uuencoded text, after compression, will nicely fit on a 1.44 Mb floppy disk.

Now, given that, through compression, the size of the SHAR file halves and that uuencoding a compressed file adds 50% to its size (each rounded to the nearest integer number of bytes), we would like to know for a given size of the SHAR file, how many floppies John needs.

Input

The first line of input contains an integer N, specifying the number of test cases. Each test case consists of a single line containing one integer S (0 <= S <= 1,000,000,000), being the size of the SHAR file in bytes.

Output

For each test case write the following sentence: 'For B bytes of SHAR file, F floppies are needed.', where B is the size of the SHAR file in bytes, and F is the minimum number of floppies needed for the transfer.

Sample Input

3

1000000

10000000

100000000

Sample Output

For 1000000 bytes of SHAR file, 1 floppies are needed.

For 10000000 bytes of SHAR file, 5 floppies are needed.

For 100000000 bytes of SHAR file, 41 floppies are needed.

 

bOtskOOl
Offline
Last seen: 10 years 3 weeks ago
Joined: 2009-02-21
bOt Points: 3500
Reverse

Problem 2       -       (50-80 points)

Reverse         

 

As you may know, in most languages, texts are written from left to right. However, exceptions exist, in which case people read from right to left (e.g. Hebrew).

Having heard about this phenomenon, and always willing to make a few bucks, John believes that he can aid the translation business by making a preprocessor for translation from left-to-right languages to right-to-left languages. The way John sees it, if we would reverse the normal text line by line, half of the work has been done.

Unfortunately, John never got around actually writing the program, since he got involved in an even more promising project involving Unicorns.

Maybe you can write this program for him.

Input Specification

The first line of input is an integer N specifying the number of test cases. Each test case consists of a single line, where each line is no longer than 80 characters. The newline is not considered to be part of the line itself.

Output Specification

For each test case, print on a single line the characters of the input line in reverse order.

Example Input

3

Frankly, I don't think we'll make much

money out of this scheme.

madam I'm adam

Example Output

hcum ekam ll'ew kniht t'nod I ,ylknarF

.emehcs siht fo tuo yenom

mada m'I madam

 

 

  

  

bOtskOOl
Offline
Last seen: 10 years 3 weeks ago
Joined: 2009-02-21
bOt Points: 3500
What base is this ??

Problem 3 - (80-120 points)

 

What base is this?

In positional notation we know the position of a digit indicates the weight of that digit toward the value of a number. For example, in the base 10 number 362 we know that 2 has the weight 100, 6 has the weight 101, and 3 has the weight 102, yielding the value 3 x 100 + 6 x 10 + 2 x 1, or just 300 + 60 + 2. The same mechanism is used for numbers expressed in other bases. While most people assume the numbers they encounter everyday are expressed using base 10, we know that other bases are possible. In particular, the number 362 in base 9 or base 14 represents a totally different value than 362 in base 10.

For this problem your program will presented with a sequence of pairs of integers. Let's call the members of a pair X and Y. What your program is to do is determine the smallest base for X and the smallest base for Y (likely different from that for X) so that X and Y represent the same value.

Consider, for example, the integers 12 and 5. Certainly these are not equal if base 10 is used for each. But suppose 12 was a base 3 number and 5 was a base 6 number? 12 base 3 = 1 x 3 + 2 x 1, or 5 base 10, and certainly 5 in any base is equal to 5 base 10. So 12 and 5 can be equal, if you select the right bases for each of them!

Input

On each line of the input data there will be a pair of integers, X and Y, separated by one or more blanks; leading and trailing blanks may also appear on each line, are are to be ignored. The bases associated with X and Y will be between 1 and 36 (inclusive), and as noted above, need not be the same for X and Y. In representing these numbers the digits 0 through 9 have their usual decimal interpretations. The uppercase alphabetic characters A through Z represent digits with values 10 through 35, respectively. The last line of the input will contain nothing but zero or more blanks (and an end of line, of course), and represents the end of the data. There will be no incorrectly formatted data in the input.

Output

For each pair of integers in the input display a message similar to those shown in the examples shown below. Of course if the two integers cannot be equal regardless of the assumed base for each, then print an appropriate message; a suitable illustration is given in the examples.

Example Input

12   5

10     A

12 34

  123   456

  1    2

  10   2

(blank)

 

 

 

Expected Output

12 (base 3) = 5 (base 6)

10 (base 10) = A (base 11)

12 (base 17) = 34 (base 5)

123 is not equal to 456 in any base 2..36

1 is not equal to 2 in any base 2..36

10 (base 2) = 2 (base 3)

 

Matte (not verified)
This is gr8!! Do i have to

This is gr8!! Do i have to register also for participating?

shubham
Offline
Last seen: 7 years 37 weeks ago
Joined: 2009-05-28
bOt Points: 134
yes you have to register

yes you have to register yourself here

Best Of luck!!

 

Happy cOding:-)

Matte (not verified)
Thank you

Thank you

shubham
Offline
Last seen: 7 years 37 weeks ago
Joined: 2009-05-28
bOt Points: 134
Competition Closed!!

bOt cOde Round 1 is closed now.

 

Thanks for your entries.

 

Results will be declared within 24 Hrs.

 

Watch out for round 2!

 

Best of Luck

 

Happy cOding