Friday, July 29, 2016

UVA 484 - The Department of Redundancy Department Solution

Unknown
#include<cstdio>
#include<vector>
#include<map>
using namespace std;

int main()
{
    int n;
    vector<int> v;
    map<int ,int> freq;
    while (scanf("%d",&n)!=EOF)
    {
        if (freq[n]==0) v.push_back(n);
        freq[n]=freq[n]+1;
    }
    int l=v.size();
    for (int i=0;i<l;i++)
        printf("%d %d\n",v[i],freq[v[i]]);
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,