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

改了一点 汗 蛋疼题目 应该出 PE

Posted by joyzho at 2011-08-07 17:53:29 on Problem 1102
In Reply To:一直WA个不停...自己觉得要注意的都注意了...试数据也没发现错误..贴代码~~哪个大牛来看下... Posted by:zzyzzy12 at 2010-08-13 20:48:05
Source Code
Memory: 344K		Time: 0MS
Language: C++		Result: Accepted
Source Code
#include <cstring>
#include <cstdio>
#include<string>
#include<fstream>
#include<iostream>
using namespace std;
string str;
int s,k,p,i,j;
char map[201][501];
int main()
{
    cin>>s>>str;
    while (s!=0)
    {
        k=1;
        for (i=1; i<=200; i++)
            for (j=1; j<=500; j++)
                map[i][j]=' ';
        for (p=0; p<str.length(); p++)
        {
            if (str[p]=='1')
            {
                for (i=2; i<=1+s; i++)
                    map[i][k+s+1]='|';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k+s+1]='|';
            }
            else if (str[p]=='2')
            {
                for (i=k+1; i<=k+s; i++)
                    map[1][i]='-';
                for (i=2; i<=1+s; i++)
                    map[i][k+s+1]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2+s][i]='-';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2*s+3][i]='-';
            }
            else if (str[p]=='3')
            {
                for (i=k+1; i<=k+s; i++)
                    map[1][i]='-';
                for (i=2; i<=1+s; i++)
                    map[i][k+s+1]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2+s][i]='-';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k+s+1]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2*s+3][i]='-';
            }
            else if (str[p]=='4')
            {
                for (i=2; i<=1+s; i++)
                    map[i][k]='|';
                for (i=2; i<=1+s; i++)
                    map[i][k+s+1]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2+s][i]='-';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k+s+1]='|';
            }
            else if (str[p]=='5')
            {
                for (i=k+1; i<=k+s; i++)
                    map[1][i]='-';
                for (i=2; i<=1+s; i++)
                    map[i][k]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2+s][i]='-';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k+s+1]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2*s+3][i]='-';
            }
            else if (str[p]=='6')
            {
                for (i=k+1; i<=k+s; i++)
                    map[1][i]='-';
                for (i=2; i<=1+s; i++)
                    map[i][k]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2+s][i]='-';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k+s+1]='|';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2*s+3][i]='-';
            }
            else if (str[p]=='7')
            {
                for (i=k+1; i<=k+s; i++)
                    map[1][i]='-';
                for (i=2; i<=1+s; i++)
                    map[i][k+s+1]='|';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k+s+1]='|';
            }
            else if (str[p]=='8')
            {
                for (i=k+1; i<=k+s; i++)
                    map[1][i]='-';
                for (i=2; i<=1+s; i++)
                    map[i][k]='|';
                for (i=2; i<=1+s; i++)
                    map[i][k+s+1]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2+s][i]='-';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k+s+1]='|';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2*s+3][i]='-';
            }
            else if (str[p]=='9')
            {
                for (i=k+1; i<=k+s; i++)
                    map[1][i]='-';
                for (i=2; i<=1+s; i++)
                    map[i][k]='|';
                for (i=2; i<=1+s; i++)
                    map[i][k+s+1]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2+s][i]='-';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k+s+1]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2*s+3][i]='-';
            }
            else
            {
                for (i=k+1; i<=k+s; i++)
                    map[1][i]='-';
                for (i=2; i<=1+s; i++)
                    map[i][k]='|';
                for (i=2; i<=1+s; i++)
                    map[i][k+s+1]='|';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k+s+1]='|';
                for (i=3+s; i<=2*s+2; i++)
                    map[i][k]='|';
                for (i=k+1; i<=k+s; i++)
                    map[2*s+3][i]='-';
            }
            k=k+s+3;
        }
        k -= 2;
        for (i=1; i<=2*s+3; i++)
        {
            for (j = 1; j <= k; j++)
                printf("%c",map[i][j]);
            printf(" ");
            printf("\n");
        }
        cout<<endl;
        cin>>s>>str;
    }
    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