#include <stdio.h>
int main()
{
int n, m, k;
int i, j;
int h, l;
scanf("%d %d %d", &n, &m, &k);
int arr[n+1][m+1];
int day[k+1];
for (i = 1; i <= n; i++){ // 录入数据
for (j = 1; j <= m; j++){
scanf("%d", &arr[i][j]);
}
}
for (i = 1; i <= k+1; i++){
day[i] = 0;
}
// 根据列来计算,数值相同就证明套相同;
for (j = 1; j <= m; j++){
int temp[1000] = {0}; // 临时数组
for (i = 1; i <= n; i++){
temp[i] = arr[i][j]; // 赋值
}
// 排除相同项
for (h = 1; h <= n; h++){
for (l = 1; l <= n; l++){
if (h != l && temp[h] == temp[l] && temp[h] != 0 && temp[l] != 0){
temp[l] = 0; // 如果同一天内,数值相同,就证明套数相同,那么只需要一套,那么后面的数据就调整为0;
}
}
}
// check行数据,如果不为0,那么就是有做题的
for (h = 1; h <= n; h++){
if (temp[h] != 0){
day[temp[h]] = day[temp[h]] + 1;
}
}
}
for (i = 1; i <= k; i++){
printf("%d ", day[i]);
}
return 0;
}
标签:arr,洛谷,int,scanf,C语言,P5594,XR,main
From: https://blog.csdn.net/qq_74568860/article/details/140299085