#include<bits/stdc++.h>
#define l long long int
using namespace std;
l gcd(l a, l b)
{
l r;
while(b != 0)
{
r = a%b;
a = b;
b = r;
}
return a;
}
int main()
{
l n, m, sum, mul, i, j;
cin >> n;
for(j=1; j<=n; j++)
{
cin >> m;
int a[m];
mul = 1, sum = 0;
for(i=0; i<m; i++)
{
cin >> a[i];
mul *= a[i];
}
for(i=0; i<m; i++)
sum += mul/a[i];
mul = m*mul;
cout << "Case " << j << ": " << mul/gcd(mul, sum) << "/" << sum/gcd(mul, sum) << endl;
}
return 0;
}
#define l long long int
using namespace std;
l gcd(l a, l b)
{
l r;
while(b != 0)
{
r = a%b;
a = b;
b = r;
}
return a;
}
int main()
{
l n, m, sum, mul, i, j;
cin >> n;
for(j=1; j<=n; j++)
{
cin >> m;
int a[m];
mul = 1, sum = 0;
for(i=0; i<m; i++)
{
cin >> a[i];
mul *= a[i];
}
for(i=0; i<m; i++)
sum += mul/a[i];
mul = m*mul;
cout << "Case " << j << ": " << mul/gcd(mul, sum) << "/" << sum/gcd(mul, sum) << endl;
}
return 0;
}
Comments
Post a Comment