forked from jeongjye/OSS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex1.c
More file actions
60 lines (47 loc) · 775 Bytes
/
ex1.c
File metadata and controls
60 lines (47 loc) · 775 Bytes
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <stdio.h>
void input(int *p, int N);
void output(int *p, int N);
int main()
{
dogsg odsjgoi dgso giosg
int M, N, k;
int x[100], y[100];
int i;
scanf("%d %d", &M, &N);
input(x, M);
input(y, N);
scanf("%d", &k);
if (M < N)
{
for (i = 0; i < M; i += k)
{
output((x + i), k);
output((y + i), k);
}
for (i = M; i < N; i += k)
output((y+i), k);
}
else
{
for (i = 0; i < N; i += k)
{
output((x + i), k);
output((y + i), k);
}
for (i = N; i < M; i += k)
output((x+i), k);
}
return 0;
}
void input(int *p, int N)
{
int *tmp;
for (tmp = p; tmp < p + N; tmp++)
scanf("%d", tmp);
}
void output(int *p, int N)
{
int *tmp;
for (tmp = p; tmp < p + N; tmp++)
printf(" %d!", *tmp);
}