Sphere Online Judge

Computer geeks! Show off your skills and claim the job of your dreams! RecruitCoders.com

SPOJ Problem Set (classical)

7108. Heptadecimal Numbers

Problem code: HEPNUM

The Factory of Computer Enhaced Numbers (FCEN) has asked its Development Comitee (DC)
to come up with a way to handle numbers written in base 17.
As everybody knows, base 17 is very important for many scientific applications, as well as for
engineering and other practical uses. Numbers in base 17 can be tough, but are kind and soft
if treated appropiately.
Numbers in base 17 are written by using a set of 17 characters: digits 0 to 9 with their usual
values, and uppercase letters A to G that have values from 10 to 16, respectively.
Base 17, probably because its basement on a prime number, does not require numbers to start
with a non-zero digit, so each number has many representations. For instance, the decimal
number 117 can be written as 6F , but also as 06F or even 00000006F .
Because of this leading-zeroes thing, heptadecimal numbers are hard to compare. As a member
of the FCEN-DC, you were asked to write a program that helps in this difficult and challenging
task.

Input

The input contains several test cases. Each test case is described in a single line that contains
two non-empty strings of at most 105 heptadecimal digits, separated by a single space. The last
line of the input contains two asterisks separated by a single space and should not be processed
as a test case.

Output

For each test case output a single line with the sign “<” if the first heptadecimal number is
smaller than the second one, the sign “>” if the first heptadecimal number is greater than the
second one, or the sign “=” if both heptadecimal numbers are equal.

Example

Input:

006F B3B
0000 0
* *

Output:
<
=

Added by:Pablo Ariel Heiber
Date:2010-08-13
Time limit:1s
Source limit:50000B
Languages:All except: PERL 6
Resource:FCEyN UBA ICPC Selection 2007

hide comments
2012-01-28 18:45:51 manish kapoor
submission code :6409597
can somebody tell me why i am getting segmentation fault continuously,pls help...thnx
2011-11-28 08:43:17 hendrik
@Seshadri: Do you believe it is good style to post algorithmic solutions here?

edit: Thanks Seshadri

Last edit: 2011-12-21 20:35:36
2011-11-09 05:37:16 Seshadri R
<comment removed respecting Hendrik's comment on revealing the algorithm in this column>

Last edit: 2011-12-05 05:26:29
2011-10-24 13:09:41 hibernating
tle tle :( :( is there any way other than calculating the decimal value and comparing....plz help

Last edit: 2011-10-24 13:12:18
2011-08-14 15:50:30 manish kapoor
5510587
i am getting run time error,but my code works fine.sm body pls suggest sm test cases...
2011-05-01 16:25:21 Piotr K±kol
@KK - I don't agree. :-) I used 10^5 char array (*2) and got AC. :-)
2011-04-06 22:21:16 Kunal Kapadia
Test cases contains even strings of length > 10^5 as char array of length 10^5 gives segmentation fault whereas that of 10^6 got acc :)
2011-01-01 13:30:39 Gurpreet Singh
any hints plzz....
i am getting WA .....

RE: finally got AC...... a silly mistake.:P

Last edit: 2011-01-03 20:51:43
SPOJ System © 2012 Sphere Research Labs | Projekty informatyczne i aplikacje na zamówienie. All Rights Reserved.