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

G++ TLE,C AC....

Posted by yuer437 at 2012-11-30 20:01:07 on Problem 2083
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define MAX 729

int n;
char s[MAX][MAX];
int main()
{
    int i,j,k,p,q;
    memset(s,' ',sizeof(s));
    s[0][0]='X';
    for(i=0;i<6;i++)
    {
        k=(int)pow(3,i);
        for(p=0;p<k;p++)
        {
            for(q=0;q<k;q++)
            {
                if(s[p][q]=='X');
                {
                    s[p][q+2*k]=s[p][q];
                    s[p+k][q+k]=s[p][q];
                    s[p+2*k][q]=s[p][q];
                    s[p+2*k][q+2*k]=s[p][q];
                }
            }
        }
    }
    while((scanf("%d",&n))&&(n!=-1))
    {
        k=(int)pow(3,n-1);
        for(i=0;i<k;i++)
        {
            for(j=0;j<k;j++)
                printf("%c",s[i][j]);
            printf("\n");
        }
        printf("-\n");
    }
    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