Repository navigation
Expand file tree
/
Copy path1027.cpp
More file actions
62 lines (55 loc) · 1.36 KB
/
Copy path1027.cpp
File metadata and controls
62 lines (55 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* ____
* ____ ___ ____ ________ __/ __/
* / __ `__ \/ __ `/ ___/ / / / /_
* / / / / / / /_/ / / / /_/ / __/
* /_/ /_/ /_/\__,_/_/ \__,_/_/
*
* @link : https://the-redback.com
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
#define ft first
#define sd second
#define mp make_pair
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define mem(a, b) memset(a, b, sizeof(a))
#define inf 1e9
#define eps 1e-9
#define mod 1000000007
#define NN 30100
#define read(a) scanf("%lld", &a)
int main() {
// ios_base::sync_with_stdio(0); cin.tie(0);
ll t = 1, tc;
read(tc);
ll i, j, k, l, m, n;
while (tc--) {
read(n);
ll zro = 0;
ll sum = 0;
for (i = 0; i < n; i++) {
read(k);
if (k < 0) {
zro++;
k = k * -1L;
}
sum += k;
}
if (zro == n) {
printf("Case %lld: inf\n", t++);
continue;
}
ll num = sum;
ll den = n - zro;
ll gcd = __gcd(num, den);
num /= gcd;
den /= gcd;
printf("Case %lld: %lld/%lld\n", t++, num, den);
}
return 0;
}