@inkysakura
2017-05-02T21:57:58.000000Z
字数 401
阅读 1413
CODE
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int ncase=0;
int main()
{
int t;
cin >>t;
while(t--)
{
int nNe=0;
int ntor=0;
int dtor;
int n;
cin >> n;
for(int i=0;i<n;i++)
{
int tp;
cin >>tp;
if(tp<0)nNe++;
ntor+=abs(tp);
}
dtor=(n-nNe);
int tp=__gcd(dtor,ntor);
dtor/=tp;
ntor/=tp;
cout <<"Case "<<++ncase<<": ";
if(dtor==0)
cout << "inf"<<endl;
else
cout <<ntor<<"/"<<dtor<<endl;
}
return 0;
}