/***
Md. Namzul Hasan
Shahjalal University of Science & technology,sylhet.
hasan08sust@gmail.com
verdict: accepted
***/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cctype>
#include<sstream>
#include<stdlib.h>
#include<map>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
map <string ,double> mp ;
int main()
{
long long i, t, j;
double time;
char c;
scanf("%lld %c", &t, &c);
getchar();
string y, str;
double sum;
char data[1000];
for (i = 1; i <= t; i++)
{
time = 0;
while (gets(data))
{
str = data;
if (x.size() == 0)
break;
else
{
time = time + 1;
mp[str] = mp[str] + 1;
}
}
map<string, double>::iterator it;
for (it = mp.begin(); it != mp.end(); it++)
{
cout << it->first <<" ";
sum = (it->second / time) * 100;
printf("%.4lf\n", sum);
}
if (i != t)
cout << "\n";
mp.clear();
}
return 0 ;
}
Md. Namzul Hasan
Shahjalal University of Science & technology,sylhet.
hasan08sust@gmail.com
verdict: accepted
***/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cctype>
#include<sstream>
#include<stdlib.h>
#include<map>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
map <string ,double> mp ;
int main()
{
long long i, t, j;
double time;
char c;
scanf("%lld %c", &t, &c);
getchar();
string y, str;
double sum;
char data[1000];
for (i = 1; i <= t; i++)
{
time = 0;
while (gets(data))
{
str = data;
if (x.size() == 0)
break;
else
{
time = time + 1;
mp[str] = mp[str] + 1;
}
}
map<string, double>::iterator it;
for (it = mp.begin(); it != mp.end(); it++)
{
cout << it->first <<" ";
sum = (it->second / time) * 100;
printf("%.4lf\n", sum);
}
if (i != t)
cout << "\n";
mp.clear();
}
return 0 ;
}
No comments:
Post a Comment