11482 - Building a Triangular Museum

All about problems in Volume 114. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
tajbir2000
New poster
Posts: 19
Joined: Fri Sep 05, 2008 6:39 pm
Location: bangladesh
Contact:

11482 - Building a Triangular Museum

Post by tajbir2000 » Tue Oct 28, 2008 8:26 pm

what's the problem???? :(
i m getting wa!!!!!

Code: Select all

#include<stdio.h>
int main(){
	int m,n,i,l,j,k, temp,q,w, e,space,cnt=1;
	while(scanf( "%d %d",&m,&n)&&m&&n){
		printf("Triangular Museum %d\n",cnt);
		temp=m*n-1;
		for(j=1;j<=n; j++){
			for(i=1;i<=m; i++){
				for(k=1;k<=temp; k++)
					printf(" ");
				if(i==1){
					for(w=1;w<=j; w++){
						space=2*(m-1) ;
						printf("%c%c" ,47,92);
						for(e=1;e<=space; e++){
							printf(" ");
						}
					}
					printf("\n") ;
					space-=2;
				}
				else if(i<m){
					for(w=1;w<=j; w++){
						printf("%c", 47);
						for(l=1;l<=2* (i-1);l++ ){
							printf(" ");
						}
						printf("%c", 92);
						for(e=1;e<=space; e++){
							printf(" ");
						}
					}
					printf("\n") ;
					space-=2;
				}
				else if(i==m){
					space=0;
					for(w=1;w<=j; w++){
						for(e=1;e<=space; e++){
							printf(" ");
						}
						space=m-i;
						printf("%c", 47);
						for(q=1;q<=2* (m-1);q++ ){
							printf("_");
						}
						printf("%c", 92);
					}
					printf("\n");
				}
				temp--;
			}
		}
		cnt++;
	}
	return 0;
}

User avatar
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 11482 - Building a Triangular Museum

Post by sohel » Wed Oct 29, 2008 7:58 am

I am not sure whether that's the only reason for getting WA, but you should print a blank line after every case.

tajbir2000
New poster
Posts: 19
Joined: Fri Sep 05, 2008 6:39 pm
Location: bangladesh
Contact:

Re: 11482 - Building a Triangular Museum

Post by tajbir2000 » Wed Oct 29, 2008 6:58 pm

still getting wa :(
i have checked blank line case

MRH
Learning poster
Posts: 51
Joined: Mon Aug 11, 2008 9:09 pm

Re: 11482 - Building a Triangular Museum

Post by MRH » Wed Nov 12, 2008 4:39 pm

HI,TAJBIR YOU ARE NOT CHECK NEW LINE
FOLLOW THIS :
Triangular Museum 1
/\
/__\
>>>>>HERE IS NEW LNE
BUT YOUR CODE NOT GIVE NEW LINE
I HOPE NOW U ACC....................

saiful_sust
Learning poster
Posts: 97
Joined: Fri Aug 22, 2008 10:18 pm
Location: CSE.SUST.SYLHET

Re: 11482 - Building a Triangular Museum

Post by saiful_sust » Tue Jan 06, 2009 11:59 am

I try to solve the problem
it seems every thing ok
But it gives me P.E

Can any one tell me

What is the reasons for giving PE for this problem.......

please help me

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Re: 11482 - Building a Triangular Museum

Post by helloneo » Tue Jan 06, 2009 1:38 pm

Maybe you print some extra spaces at the end of lines..

saiful_sust
Learning poster
Posts: 97
Joined: Fri Aug 22, 2008 10:18 pm
Location: CSE.SUST.SYLHET

Re: 11482 - Building a Triangular Museum

Post by saiful_sust » Tue Jan 06, 2009 7:01 pm

Saiful wrote: Thanks helloneo for ur reply.....

i can't find the bug..
Here is my code.....
plz help me..... :oops: :oops: :oops: :oops: :oops:

Code: Select all

CUT AFTER ACC>>>>>>>>>>>>>>>>>>>>>>>
Last edited by saiful_sust on Thu Jan 08, 2009 10:48 am, edited 1 time in total.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11482 - Building a Triangular Museum

Post by Jan » Wed Jan 07, 2009 2:42 pm

Input:

Code: Select all

2 1
0 0
Output:

Code: Select all

Triangular Museum 1
B/\
/__\

Here B stands for a blank. But your code prints

Code: Select all

Triangular Museum 1
B/\B
/__\

An extra space in the first line. Hope it helps.
Ami ekhono shopno dekhi...
HomePage

saiful_sust
Learning poster
Posts: 97
Joined: Fri Aug 22, 2008 10:18 pm
Location: CSE.SUST.SYLHET

Re: 11482 - Building a Triangular Museum

Post by saiful_sust » Thu Jan 08, 2009 10:49 am

Thanks jan
i got it.......... :) :) :) :) :) :)

tajbir2000
New poster
Posts: 19
Joined: Fri Sep 05, 2008 6:39 pm
Location: bangladesh
Contact:

Re: 11482 - Building a Triangular Museum

Post by tajbir2000 » Sun Jan 11, 2009 9:11 pm

i m getting pe with this code pls help me....

Code: Select all

#include<stdio.h>
int main(){
   int m,n,i,l,j,k, temp,q,w, e,space,cnt=1;
   while(scanf( "%d %d",&m,&n)&&m&&n){
	   
      printf("Triangular Museum %d\n",cnt);
      temp=m*n-1;
      for(j=1;j<=n; j++){
         for(i=1;i<=m; i++){
            for(k=1;k<=temp; k++)
               printf(" ");
            if(i==1){
               for(w=1;w<=j; w++){
                  space=2*(m-1) ;
                  printf("%c%c" ,47,92);
                  for(e=1;e<=space; e++){
                     printf(" ");
                  }
               }
               printf("\n") ;
               space-=2;
            }
            else if(i<m){
               for(w=1;w<=j; w++){
                  printf("%c", 47);
                  for(l=1;l<=2* (i-1);l++ ){
                     printf(" ");
                  }
                  printf("%c", 92);
                  for(e=1;e<=space; e++){
                     printf(" ");
                  }
               }
               printf("\n") ;
               space-=2;
            }
            else if(i==m){
               space=0;
               for(w=1;w<=j; w++){
                  for(e=1;e<=space; e++){
                     printf(" ");
                  }
                  space=m-i;
                  printf("%c", 47);
                  for(q=1;q<=2* (m-1);q++ ){
                     printf("_");
                  }
                  printf("%c", 92);
               }
               printf("\n");
            }
            temp--;
         }
      }
	  printf("\n");
      cnt++;
   }
   return 0;
}



Post Reply

Return to “Volume 114 (11400-11499)”