/*** | |
Md. Nazmul Hasan | |
Shahjalal University of Science & Technology,Sylhet. | |
hasan08sust@gmail.com | |
***/ | |
#include<iostream> | |
#include<cstdio> | |
#include<stack> | |
#include<queue> | |
#include<map> | |
#include<vector> | |
#include<algorithm> | |
#include<cstring> | |
#include<sstream> | |
#include<cmath> | |
#include <iomanip> | |
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)) | |
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ; | |
#define new_line pf("\n") | |
#define clear_data(array) memset(array,0,sizeof(array)) | |
#define highest_int 2147483647 | |
int main() | |
{ | |
int test,n,cs=1,m,p; | |
int num[10001],uni[10001]; | |
vector<int>data[10001]; | |
char ch='%'; | |
map<int,int>my_map; | |
sc("%d",&test); | |
while(test--){ | |
memset(num,0,sizeof(num)); | |
memset(uni,0,sizeof(uni)); | |
sc("%d",&n); | |
for(int i=0 ; i<n ; i++){ | |
sc("%d",&m); | |
while(m--){ | |
sc("%d",&p); | |
data[i].pb(p); | |
} | |
sort(data[i].begin(),data[i].end()); | |
if(data[i].size() > 0){ | |
num[data[i][0]]++; | |
} | |
for(int j=1 ; j<data[i].size() ; j++){ | |
if(data[i][j] != data[i][j-1]) | |
num[data[i][j]]++; | |
} | |
} | |
int sum=0 ; | |
for(int i=0 ; i<n ; i++){ | |
if(data[i].size()>0 && num[data[i][0]]==1) | |
uni[i]++; | |
for(int j=1 ; j<data[i].size() ; j++){ | |
if(data[i][j]!=data[i][j-1] && num[data[i][j]]==1) | |
uni[i]++; | |
} | |
sum += uni[i]; | |
} | |
pf("Case %d:",cs++); | |
for(int i=0 ; i<n ; i++){ | |
double result = (double)uni[i]*100/(double)sum; | |
pf(" %.6lf%%",result); | |
data[i].clear(); | |
} | |
pf("\n"); | |
} | |
return 0; | |
} |
21 October 2017
uva 11348 (Exhibition)
Subscribe to:
Post Comments (Atom)
-
/*** Md. Nazmul Hasan Shahjalal University of Science & Technology,Sylhet. hasan08sust@gmail.com ***/ #include<iostream> #i...
-
n = 1 while n: str = input () # print('Case no# %d :'%n) if str == ' * ' : break if str == ' Hajj ...
-
/*** Md. Namzul Hasan Shahjalal University of Science & technology,sylhet. hasan08sust@gmail.com ***/ #include<bits/stdc++.h...
No comments:
Post a Comment