#include<stdio.h>
void main()
{
//其中第一条斜线是00 - 11 - 22 -33 第二条10 - 21 - 32
int arr2[4][4] = { 00, 01, 02, 03,
10 , 11, 12, 13,
20 , 21, 22, 23,
30, 31, 32, 33,};
int i, j;
int sum = 0;
int index = 0;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
//printf("最初的i=%d", i);
//满足这个条件的情况下
if (j - i == j)
{
int index = j ;
printf("\n\n\n%d\n\n", index);
printf("i=%d,j=%d\n", i, j);
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
if (j - i == index)
{
sum += arr2[i][j];
}
}
}
printf("y行的数 据时%d\n", sum);
system("pause");
sum = 0;
}
if (i - j == i)
{
int index = i;
printf("\n\n\n%d\n\n", index);
printf("i=%d,j=%d\n", i,j);
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
if (i - j == index)
{
sum += arr2[i][j];
}
}
}
printf("%d\n", sum);
system("pause");
sum = 0;
}
}
}
system("pause");
}
最小堆 / 优先队列(C语言实现),布布扣,bubuko.com
最小堆 / 优先队列(C语言实现)