int oddCells(int n, int m, int** indices, int indicesSize, int* indicesColSize){
int i,j,k,count=0;
int a[50][50];
*indicesColSize=2;
for(i=0;i<n;i++)
for(j=0;j<m;j++)
a[i][j]=0;
for(j=0;j<m;j++)
{
for(k=0;k<indicesSize;k++)
a[indices[k][0]][j]++;
}
for(i=0;i<n;i++)
{
for(k=0;k<indicesSize;k++)
a[i][indices[k][1]]++;
}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(a[i][j]%2!=0)
count++;
}
}
return count;
}
1252.奇数值单元格的数目
最新推荐文章于 2024-08-08 16:19:29 发布