UVa Problem Solution: 706 - LC-Display
来源:互联网 发布:大众汽车ods软件 编辑:程序博客网 时间:2024/04/26 19:39
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;
- }
- UVa Problem Solution: 706 - LC-Display
- UVa Problem 706 LC-Display (液晶显示屏)
- UVa Problem 706 LC-Display (液晶显示屏)
- UVa 706 Problem: LC-Display (PC 110104)
- uva 706 LC-Display
- UVa 706 LC-Display
- uva 706 LC-Display
- UVA 706 LC-Display
- 模拟 UVa 706 LC-Display
- PC/UVa 110104/706 LC-Display
- 706 - LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- Asp.net 数据采集基类(远程抓取,分解,保存,匹配)
- UVA_11526 H(n)
- PHP中缩放图像
- VIM 配置文件
- 超清晰的document对象详解
- UVa Problem Solution: 706 - LC-Display
- navigator.userAgent.indexOf来判断浏览器类型
- prototype学习笔记(Element篇一)
- php常用ODBC函数集
- hibernate native sql 查询介绍
- php常用XML函数集
- hehe
- 模板类声明和定义为何要写一起
- php常用Socket和SNMP函数集