Traffic ControlProblem code: CRAFT03 |
With the advent of technology, the speed of cars has increased considerably. So have the traffic rules to keep them under control. Sophisticated electronic devices are used to sense speed and digital cameras to identify the car. While the automobile technology has reached India, the speed control techniques are still very obsolete. The traffic police usually have to remember the Registration number of the car while it flashes past him at sky high speeds.
We know that certain numbers are easy to remember as entering in sequence of digits implies an easy-to-remember geometric figure. For simplicity we shall assume that the Registration number of each car is entirely numeric, i.e, contains only digits (0-9).
For each Registration number, we can make a corresponding geometric figure, Number Plot, which is a sequence of connected line segments. Assume that a registration number with n digits is a1 a2 a3 . . . an-1 an. The first line segment of Number Plot is a line segment connecting the center points of square a1 and square a2 . The second line segment of Number Plot connects the center points of square a2 and a3. In a similar way the k-th line segment connects the center points of square ak and square ak+1 , and the last segment connects an-1 and an.
Input
Your program is to read from standard input. The number of test cases N is given in the first line of the input. The following N lines contain the Registration numbers. Assume that the Registration Numbers are of fixed size of 8 digits.
Output
Your program is to write to standard output. For each test case you have to print the number of distinct lines in the plot.
Example
For example, the number plot for the number 15803517 and 15906395 are,
The plots contain 5 and 4 distinct lines respectively. Similarly various different plots may contain varying number of distinct lines. It is easy to remember the number with lesser number of distinct lines. If the plot is reduced to a single point, the number of distinct lines is considered as Zero.
Input: 4 15803517 15906395 55555555 12580889 Output: 5 4 0 3
| Author: | aman871988 |
| Date Added: | 4-03-2010 |
| Time Limit: | 25 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

where is the figure
where is the figure ???
please clear the meaning . . . .
hav solved this ques. and it
hav solved this ques. and it is giving correct answeron my system but judje is showing wrong ans. plz help me..
provide some tricky cases
@vipul There is no tricky
@vipul
There is no tricky case, u might be missing something.
was tricky:-)
was tricky:-)
still i am not getting wats
still i am not getting wats wrong with my code..plz help