Output related problem. I use a predefined bitmap of all the numbers and enlarge them when displaying.
Code:
- /*************************************** **********************************
- * Copyright (c) 2008 by liukaipeng *
- * Liukaipeng at gmail dot com *
- **************************************** *********************************/
- /* @ Judge_id 00000 706 C "LC-display "*/
- # Include <stdio. h>
- # Include <stdlib. h>
- # Include <string. h>
- # Include <strings. h>
- Int bitmap_row (int r, int S)
- {
- If (r = 0)
- Return 0;
- Else if (r = S + 1)
- Return 2;
- Else if (r = 2 * (S + 1 ))
- Return 4;
- Else if (r <S + 1)
- Return 1;
- Else
- Return 3;
- }
- Int bitmap_col (int c, int S)
- {
- If (C = 0)
- Return 0;
- Else if (C = S + 1)
- Return 2;
- Else
- Return 1;
- }
- Int main (INT argc, char * argv [])
- {
- # Ifndef online_judge
- Char in [256];
- Char out [256];
- Strcpy (in, argv [0]);
- Strcat (in, ". In ");
- Freopen (in, "r", stdin );
- Strcpy (Out, argv [0]);
- Strcat (Out, ". Out ");
- Freopen (Out, "W", stdout );
- # Endif
- Char bitmap [5] [30] = {
- "--------",
- "| ",
- "-------",
- "| ",
- "-------",
- };
- Int S, L, N, I, j, row, Col;
- Char Buf [10];
- For (scanf ("% d % s/n", & S, Buf); s! = 0; scanf ("% d % s/n", & S, Buf )){
- L = strlen (BUF );
- For (I = 0; I <2 * s + 3; ++ I ){
- Row = bitmap_row (I, S );
- For (j = 0; j <(S + 2) * l; ++ J ){
- If (j> 0 & J % (S + 2) = 0)
- Putchar ('');
- N = Buf [J/(S + 2)]-'0 ';
- Col = bitmap_col (J % (S + 2), S );
- Col + = 3 * N;
- Putchar (Bitmap [row] [col]);
- }
- Putchar ('/N ');
- }
- Putchar ('/N ');
- }
- Return 0;
- }