## 10331 - The Flyover Construction

Moderator: Board moderators

babor
New poster
Posts: 16
Joined: Sat Jun 07, 2003 4:23 pm
Contact:

### 10331- Wa

Hai everybody,
I got wa at 10331 Flyover construction.
Any hints or advice to avoid this .
babor

erfan
New poster
Posts: 44
Joined: Tue Apr 15, 2003 4:31 pm
Contact:
Hello all greathelper,
I also got WA in this problem.
I solve it by shortest path (again and again.)
Please give me such critical I/O to test my code.

rhsumon
New poster
Posts: 48
Joined: Wed Aug 23, 2006 12:29 pm
Location: Dhaka

### Re: I am having real trouble with 10331 the Flyover construction

Presentation Error:::::::: Why PE
My output code is like,

Code: Select all

``````		for(i=1; i<=m; i++){
if(count[i]==max){
printf("%d",i);
if(i<m) printf(" ");
}
}
printf("\n");
``````
Is there any problem .............

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

### Re: I am having real trouble with 10331 the Flyover construction

rhsumon wrote:Presentation Error:::::::: Why PE
My output code is like,

Code: Select all

``````		for(i=1; i<=m; i++){
if(count[i]==max){
printf("%d",i);
if(i<m) printf(" ");
}
}
printf("\n");
``````
Is there any problem .............
Of course, there is. Just think that count[m-1] = max and count [m] < max.... Then a trailing space will be printed. Am I right? You can solve this problem easily...

Code: Select all

``````		int flag=0;
for(i=1; i<=m; i++){
if(count[i]==max){
if(flag++) printf(" ");
printf("%d",i);
}
}
printf("\n");
``````
Hope it helps.
Ami ekhono shopno dekhi...
HomePage

rhsumon
New poster
Posts: 48
Joined: Wed Aug 23, 2006 12:29 pm
Location: Dhaka

### Re: I am having real trouble with 10331 the Flyover construction

Thnkx but some problem........
But is that false.......... if i reform my code like that..

Code: Select all

``````Actually i've understood..........
What a stupid am i!!!!!!!!!!!!!!!!!!!!!!!!! :x
``````
Is there also print any trailing " "? I'm confused.............
Ok u r correct but i am confusing abt that