Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cctype>
- #include <stack>
- #include <queue>
- #include <list>
- #include <vector>
- #include <map>
- #include <set>
- #include <sstream>
- #include <stdlib.h>
- #include <cmath>
- #define FOR(i,A) for(typeof (A).begin() i = (A).begin() ; i != (A).end() ; i++)
- #define mp make_pair
- #define debug( x ) cout << #x << " = " << x << endl
- #define clr(v,x) memset( v, x , sizeof v )
- #define all(x) (x).begin() , (x).end()
- #define rall(x) (x).rbegin() , (x).rend()
- #define TAM 110
- using namespace std;
- typedef pair<int,int> ii ;
- typedef long long ll ;
- typedef long double ld ;
- typedef pair<int,ii> pii ;
- int main() {
- int t,n,a,aux;
- scanf("%d",&t);
- int cont=1;
- while(t--){
- map<int,int> mp;set<int> s;double osp;bool entro=true;
- map <int,int> ::iterator it;
- scanf("%d",&n);
- if(n==0) {
- printf("Case %d: \n",cont);cont++;continue;
- }
- for(int i=0;i<n;i++){
- scanf("%d",&a);
- for(int j=0;j<a;j++){
- scanf("%d",&aux);
- if(mp.count(aux)==0){
- mp[aux]=i+1;s.insert(aux);
- }else if(mp.count(aux)!=0 && mp[aux]!=i+1){
- mp[aux]=0;s.erase(aux);
- }
- }
- }
- if(mp.empty()){printf("Case %d: \n",cont);cont++;continue;}
- printf("Case %d: ",cont);int cont1;
- for(int i=0;i<n;i++){
- cont1=0;
- for(it=mp.begin();it!=mp.end();it++){
- //printf("%d",it->second);
- if((it->second)==i+1) cont1++;
- }
- if(s.size()!=0) osp=((double)cont1/(double)(s.size()))*(100.0);
- else osp=0;
- if(i!=n-1){
- printf("%.6lf%% ",osp);
- }else printf("%.6lf%%\n",osp);
- }
- cont++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement