## 11482 - Building a Triangular Museum

Moderator: Board moderators

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

### 11482 - Building a Triangular Museum

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;
}``````

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

### Re: 11482 - Building a Triangular Museum

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
Contact:

### Re: 11482 - Building a Triangular Museum

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

HI,TAJBIR YOU ARE NOT CHECK NEW LINE
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

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.......

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

### Re: 11482 - Building a Triangular Museum

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

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

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

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
Contact:

### Re: 11482 - Building a Triangular Museum

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

Thanks jan
i got it..........

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

### Re: 11482 - Building a Triangular Museum

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;
}

``````