Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

贡献我的代码

Posted by seedeed at 2011-03-25 23:20:18 on Problem 1102
#include "cstdio"
char flag[10]={119,36,93,109,46,107,123,37,127,111};
void print(char *x,int s)
{
	int i,j,k;
	char temp;
	for(j=0;x[j];j++)
	{
		if(flag[x[j]-'0']&1) temp='-';
		else temp=' ';
		putchar(' ');
		for(k=1;k<=s;k++)
			putchar(temp);
		putchar(' ');
		putchar(' ');
	}
	puts("");
	for(i=1;i<=s;i++)
	{
		for(j=0;x[j];j++)
		{
			if(flag[x[j]-'0']&2) temp='|';
			else temp=' ';
			putchar(temp);
			for(k=1;k<=s;k++)
				putchar(' ');
			if(flag[x[j]-'0']&4) temp='|';
			else temp=' ';
			putchar(temp);
			putchar(' ');
		}
		puts("");
	}
	for(j=0;x[j];j++)
	{
		if(flag[x[j]-'0']&8) temp='-';
		else temp=' ';
		putchar(' ');
		for(k=1;k<=s;k++)
			putchar(temp);
		putchar(' ');
		putchar(' ');
	}
	puts("");
	for(i=1;i<=s;i++)
	{
		for(j=0;x[j];j++)
		{
			if(flag[x[j]-'0']&16) temp='|';
			else temp=' ';
			putchar(temp);
			for(k=1;k<=s;k++)
				putchar(' ');
			if(flag[x[j]-'0']&32) temp='|';
			else temp=' ';
			putchar(temp);
			putchar(' ');
		}
		puts("");
	}
	for(j=0;x[j];j++)
	{
		if(flag[x[j]-'0']&64) temp='-';
		else temp=' ';
		putchar(' ');
		for(k=1;k<=s;k++)
			putchar(temp);
		putchar(' ');
		putchar(' ');
	}
	puts("");
}
int main()
{
	int s;
	char n[20];
	while(scanf("%d%s",&s,n),n[0]!='0'||s)
	{
			print(n,s);
			puts("");
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator