#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll i,j,k,l,m,n,test,ng,sum;
cin>>test;
for(k=1;k<=test;k++)
{
cin>>n;
ng=0;
sum=0;
for(i=0;i<n;i++)
{
cin>>m;
sum+=abs(m);
if(m>0)
{
ng++;
}
}
cout<<"Case "<<k<<": ";
if(ng==0)
{
cout<<"inf"<<endl;
}
else
{
cout<<sum/__gcd(sum,ng)<<"/"<<ng/__gcd(sum,ng)<<endl;
}
}
return 0;
}
using namespace std;
typedef long long ll;
int main()
{
ll i,j,k,l,m,n,test,ng,sum;
cin>>test;
for(k=1;k<=test;k++)
{
cin>>n;
ng=0;
sum=0;
for(i=0;i<n;i++)
{
cin>>m;
sum+=abs(m);
if(m>0)
{
ng++;
}
}
cout<<"Case "<<k<<": ";
if(ng==0)
{
cout<<"inf"<<endl;
}
else
{
cout<<sum/__gcd(sum,ng)<<"/"<<ng/__gcd(sum,ng)<<endl;
}
}
return 0;
}
No comments:
Post a Comment