Algorithm/Baekjoon
[Algorithm]Baekjoon 16967번 :: 배열 복원하기
MaxLevel
2023. 5. 10. 15:26
https://www.acmicpc.net/problem/16967
16967번: 배열 복원하기
크기가 H × W인 배열 A와 두 정수 X와 Y가 있을 때, 크기가 (H + X) × (W + Y)인 배열 B는 배열 A와 배열 A를 아래로 X칸, 오른쪽으로 Y칸 이동시킨 배열을 겹쳐 만들 수 있다. 수가 겹쳐지면 수가 합쳐
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
int b[602][602] = { 0 };
int h, w, x, y;
int main(void)
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> h >> w >> x >> y;
for (int i = 0; i < h+x; ++i)
{
for (int j = 0; j < w+y; ++j)
{
cin >> b[i][j];
}
}
for (int i = x; i < h; ++i)
{
for (int j = y; j < w; ++j)
{
int temp = b[i][j] - b[i - x][j - y];
int temp2 = b[i][j] - temp;
b[i][j] -= temp2;
int asdf = 0;
}
}
for (int i = 0; i < h; ++i)
{
for (int j = 0; j < w; ++j)
{
printf("%d ", b[i][j]);
}
printf("\n");
}
return 0;
}
|
cs |
출력할때 한칸씩 띄워서 출력해야 한단것만 알면 크게 어려울 것 없는 문제.