## 11100 - The Trip, 2007

Moderator: Board moderators

mak(cse_DU)
Learning poster
Posts: 72
Joined: Tue May 30, 2006 5:57 pm

### Re: 11100 - The Trip, 2007

Dear Ankit,
Output an empty line between cases
Mak
Help me PLZ!!

anis_cuet016
New poster
Posts: 15
Joined: Thu Jul 08, 2010 8:28 am

### Re: 11100 - The Trip, 2007

Hlw ......

This problem bugged me a lot ..... at got finally accepted after many try and now at ranked 7 .....

btw notedown this things
1. take the input ...

for (long cs = 1; scanf("%ld", &n) == 1 && n > 0; cs++)
{
take_input();
process .....
}

2. print blank line between cases, except last.

check this inputs:
IN:

10
1 1 1 2 2 2 3 3 4 4
10
1 1 1 1 1 2 3 4 5 6
6
1 1 1 1 1 1
10
1 1 1 2 2 2 3 3 3 3

OUT:
3
1 2 3 4
1 2 3
1 2 4

5
1 2
1 3
1 4
1 5
1 6

6
1
1
1
1
1
1

4
1 2 3
1 2 3
1 3
2 3

Hope it helps .......

Ahshua
New poster
Posts: 7
Joined: Fri Jul 02, 2010 3:05 pm

### Re:

Code: Select all

``````#include<iostream>
using namespace std;

int main()
{
int n,i,j,count,max,temp,prev;
int arr[10010];
while(cin>>n)
{
if(n==0)
break;

for(i=0;i<n;i++)
cin>>arr[i];

for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
if(arr[i]>arr[j])
{
temp=arr[j];
arr[j]=arr[i];
arr[i]=temp;
}
}
}
max=1;
count=1;
for(i=1;i<n;i++)
{
if(arr[i-1]==arr[i])
count++;

else if(count>max)
{
max=count;
count=1;
}

else
count=1;
}
cout<<max<<"\n";
for(i=0;i<max;i++)
{
cout<<arr[i];
for(j=i+max;j<n;j+=max)
cout<<" "<<arr[j];
cout<<"\n";
}

cout<<"\n";
}
}``````
Thanks!!!!
Hi,Pay attention to Output an empty line between cases ,please!
Try Output an empty line between cases again,you'll be surprise!

dibery
Learning poster
Posts: 76
Joined: Sat Feb 23, 2013 4:16 pm
Location: Taiwan, Taipei
Contact:

### Re: 11100 - The Trip, 2007

in:

10
1 2 4 2 3 2 3 3 3 3

possible out:
1 3
2 3
2 3
2 3
4 3
Life shouldn't be null.