Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
也发一个我的代码吧,只有10多行核心思想也是查表,一个数字有3条横线4条竖线需要控制,这些信息保存在不同的bit位上,这样下来整个表只有5个整数 int g[] = { 1005, 892, 877, 1021867, 768667 }, a, b, n; char r[114], c, *q, *p, s[12]; void H(int l) { for (q = r, p = s; c = *p++; *q++ = 32, *q++ = 32) for (*q++ = 32, a = n; a--; *q++ = g[l] & 1 << (c - 48) ? 45 : 32); *--q = 0; puts(r); } void V(int l) { for (q = r, p = s; c = *p++; *q++ = g[l + 3] & 1 << b ? 124 : 32, *q++ = 32) for (b = 2 * (c - 48), *q++ = g[l + 3] & 1 << b++ ? 124 : 32, a = 0; a++ < n; *q++ = 32); *--q = 0; } int main(int j) { for (; scanf("%d %s", &n, s), n; H(2), puts("")) for (j = 2; j--;) for (H(1 - j), V(1 - j), a = n; a--; puts(r)); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator