-
Notifications
You must be signed in to change notification settings - Fork 0
/
g02.c
115 lines (103 loc) · 1.69 KB
/
g02.c
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include <stdio.h>
#include <stdlib.h>
#define N 300000
#define V 1000000
static void test00(void)
{
printf("1\n");
printf("5\n");
}
static void test01(void)
{
printf("10\n");
printf("0 1 2 3 4 5 6 7 8 9\n");
}
static void test02(void)
{
printf("10\n");
printf("9 8 7 6 5 4 3 2 1 0\n");
}
static void test03(void)
{
printf("10\n");
printf("3 3 3 3 3 3 3 3 3 3\n");
}
static void test04(void)
{
int n = N;
int i;
printf("%d\n", n);
for (i = 0; i < n; i++)
printf("%d\n", (i & 1) ? i : V - i);
}
static void test05(void)
{
int n = N;
int i;
printf("%d\n", n);
for (i = 0; i < n; i++)
printf("%d\n", i % 23);
}
static void test06(void)
{
int n = N;
int i;
printf("%d\n", n);
for (i = 0; i < n; i++)
printf("%d\n", i % 12345 - 10000);
}
static void test07(void)
{
int n = N;
int i;
printf("%d\n", n);
srand(7);
for (i = 0; i < n; i++)
printf("%d\n", 300000 + rand() % 5);
}
static void test08(void)
{
int n = N;
int i;
printf("%d\n", n);
srand(8);
for (i = 0; i < n; i++)
printf("%d\n", 300000 + rand() % 500);
}
static void test09(void)
{
int n = N;
int i;
printf("%d\n", n);
srand(9);
for (i = 0; i < n; i++)
printf("%d\n", -200000 + rand() % 500000);
}
int main(int argc, char *argv[])
{
if (argc != 2)
return 1;
else if (atoi(argv[1]) == 0)
test00();
else if (atoi(argv[1]) == 1)
test01();
else if (atoi(argv[1]) == 2)
test02();
else if (atoi(argv[1]) == 3)
test03();
else if (atoi(argv[1]) == 4)
test04();
else if (atoi(argv[1]) == 5)
test05();
else if (atoi(argv[1]) == 6)
test06();
else if (atoi(argv[1]) == 7)
test07();
else if (atoi(argv[1]) == 8)
test08();
else if (atoi(argv[1]) == 9)
test09();
else
return 1;
return 0;
}