mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
38 lines
670 B
C++
38 lines
670 B
C++
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
int a[10010];
|
||
|
int gcd(int a, int b)
|
||
|
{
|
||
|
return b > 0 ? gcd(b, a%b) : a;
|
||
|
}
|
||
|
int n, m;
|
||
|
void Solve()
|
||
|
{
|
||
|
while(~scanf("%d%d", &n, &m))
|
||
|
{
|
||
|
if(!n && !m)
|
||
|
{
|
||
|
break;
|
||
|
}
|
||
|
int sum = 0;
|
||
|
for(int i = 0; i < n; ++i)
|
||
|
{
|
||
|
for(int j = 0; j < m; ++j)
|
||
|
{
|
||
|
scanf("%d", &a[i]);
|
||
|
}
|
||
|
sum += a[i];
|
||
|
}
|
||
|
for(int i = 0; i < n; ++i)
|
||
|
{
|
||
|
int t = gcd(sum, a[i]);
|
||
|
printf("%d / %d\n", a[i]/t, sum/t);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
int main()
|
||
|
{
|
||
|
Solve();
|
||
|
return 0;
|
||
|
}
|