Uva 484 - The Department of Redundancy Department
#include<bits/stdc++.h>
#define mx4 1000100
using namespace std;
typedef long long LL;
typedef map<string,int>mpsii;
typedef map<string,bool>mpsb;
typedef map<LL,bool>mpbll;
typedef map<LL,LL>mpll;
LL ar[mx4];
int main()
{
LL n, len=0;
mpll mp;
while(cin >> n)
{
if(!mp.count(n)) // check existence. Return boolean data
{
ar[len++] = n;
mp[n] = 1;
}
else
{
mp[n]++;
}
}
for(LL i=0;i<len;i++)
{
cout << ar[i] << " " << mp[ar[i]] << "\n";
}
return 0;
}
#define mx4 1000100
using namespace std;
typedef long long LL;
typedef map<string,int>mpsii;
typedef map<string,bool>mpsb;
typedef map<LL,bool>mpbll;
typedef map<LL,LL>mpll;
LL ar[mx4];
int main()
{
LL n, len=0;
mpll mp;
while(cin >> n)
{
if(!mp.count(n)) // check existence. Return boolean data
{
ar[len++] = n;
mp[n] = 1;
}
else
{
mp[n]++;
}
}
for(LL i=0;i<len;i++)
{
cout << ar[i] << " " << mp[ar[i]] << "\n";
}
return 0;
}
Comments
Post a Comment