#include <stdio.h>
int main(void){
int a[20][20] = {};
int q,i,j,x,y;
scanf("%d",&q);
for(i = 0; i < q; i++)
{
scanf("%d %d",&x,&y);
a[x][y] = 1;
}
for(i = 1; i < 21; i++)
{
for(j = 1; j < 21; j++)
{
printf("%d ",a[i][j]);
}
printf("\n");
}
}
//Enter your code here
It's a code to make a checkerboard and set what's on the checkerboard. It's 19*19. But it's 19*19, but when you set the array, you have to set it as a[20][20], so isn't the array 20*20? Another concept says it's created in 2020, but it's created in 1919 I don't understand why this is happening. Some sites have 34 arrays if you set it to 34 I'm so confused that it's set up in 2020 and it's arranged in 1919.
2d-array
c (and its children) programmers don't count 1, 2, 3, they count 0, 1, 3.
The first element of the one-dimensional array a[10]
is a[0]
, then a[1]
, ..., the last element is a[9]
.
© 2024 OneMinuteCode. All rights reserved.