ACCEPTED !! Though late, i realize how useful the UVa forum is....
____________________________________________________________________
Question: Exhibition
____________________________________________________________________
#include "iostream.h"
#include "iomanip.h"
int main()
{
int t;
cin >> t;
for(int i = 1; i <= t; i++) {
int type[10001];
for(int j = 0; j < 10001; j++) type[j] = 0;
int mat[50][52];
int n;
cin >> n;
for(int j = 0; j < n; j++) {
int m;
cin >> m;
mat[j][0] = m;
mat[j][1] = 0;
for(int k = 0; k < m; k++) {
cin >> mat[j][k+2];
type[mat[j][k+2]]++;
}
}
int ucount = 0;
for(int j = 0; j < n; j++) {
for(int k = 0; k < mat[j][0]; k++) {
type[mat[j][k+2]]--;
}
for(int k = 0; k < mat[j][0]; k++) {
if(type[mat[j][k+2]] == 0) {
mat[j][1]++;
ucount++;
}
type[mat[j][k+2]]++;
}
}
cout << "Case " << i << ":";
cout.setf(ios::fixed);
for(int j = 0; j < n; j++) {
double perc = 33.333333;
if(ucount != 0) perc = mat[j][1] * 100.00 / ucount;
cout << setprecision(6) << " " << perc << "%";
}
cout << endl;
}
return 0;
}____________________________________________________________________
Sunday, December 9, 2007
Exhibition
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment