## 11286 - Conformity

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

Moderator: Board moderators

Repon kumar Roy
Learning poster
Posts: 96
Joined: Tue Apr 23, 2013 12:54 pm

### Re: 11286 - Conformity

Can you tell me ? how the output of the second case is 3 ?? What is the combination ?

I didn't find what actually is told to compute ?

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 11286 - Conformity

Every combination has one student taking it, so they are all the most popular.
Check input and AC output for thousands of problems on uDebug!

garbage
New poster
Posts: 19
Joined: Thu Feb 21, 2013 5:46 am

### Re: 11286 - Conformity, Getting WA, Need Help...

Code: Select all

``````#include<iostream>
#include<cstdio>
#include<string>
#include<map>
using namespace std;

string sortedString(string ch)
{
int len = ch.length();

for(int i=0;i<len-1;i++)
{
for(int j=i+1;j<len;j++)
{
if(ch[i]>ch[j])
{
char t = ch[i];
ch[i] = ch[j];
ch[j] = t;
}
}
}
return ch;
}

int main()
{
long n;
string ch;

while(cin>>n)
{
if(n == 0)
break;

map<string, long>myMap;
map<string, long>::iterator it;

long mx = 0;
for(long i=1;i<=n;i++)
{
string S, total = "";
for(int j =1;j<=5;j++)
{
cin>>ch;
total = total + ch;
}

S = sortedString(total);

myMap[S]++;

if(mx < myMap[S])
mx = myMap[S];
}

long cnt = 0;
for(it = myMap.begin(); it!=myMap.end();it++)
if(it->second == mx)
cnt += it->second;

cout<<cnt<<endl;
}
return 0;
}``````

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 11286 - Conformity

Input:

Code: Select all

``````3
100 101 102 103 488
100 101 102 103 488
110 111 200 388 400
0
``````
Output should be 2
Check input and AC output for thousands of problems on uDebug!

garbage
New poster
Posts: 19
Joined: Thu Feb 21, 2013 5:46 am

### Re: 11286 - Conformity

thnx brianfry713...