11100 - The Trip, 2007

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

Moderator: Board moderators

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

Re: 11100 - The Trip, 2007

Post by mak(cse_DU) » Fri Aug 22, 2008 9:07 pm

Dear Ankit,
Read below statement.
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

Post by anis_cuet016 » Thu Aug 19, 2010 1:20 pm

Hlw ......

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

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:

Post by Ahshua » Tue Sep 14, 2010 8:27 am

ankit.arora wrote:hi! I am getting WA can anyone please help me out..... here's my code!

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! :wink:

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

Re: 11100 - The Trip, 2007

Post by dibery » Wed Jul 31, 2013 8:10 am

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.

Post Reply

Return to “Volume 111 (11100-11199)”