Fixed 24th and 36th tasks, fixed names for 71th and 41th
This commit is contained in:
parent
1590534203
commit
422ee86263
5
18/24.csv
Normal file
5
18/24.csv
Normal file
@ -0,0 +1,5 @@
|
||||
10 ;20 ;10 ;30 ;40
|
||||
101;101;30 ;15 ;50
|
||||
5 ;7 ;8 ;200;1
|
||||
6 ;-10;10 ;200;80
|
||||
-30;-10;11 ;12 ;1
|
|
26
18/24.py
26
18/24.py
@ -11,19 +11,31 @@ def count(a: list[list[int]], i: int, j: int) -> list[int]:
|
||||
|
||||
c = a[i][j]
|
||||
|
||||
if r == None and b == None and i == len(a)-1 and j == len(a[0])-1:
|
||||
return [[c, [[i, j]]], [c, [[i, j]]]]
|
||||
if r == None and b == None:
|
||||
return [c, c]
|
||||
return None
|
||||
if r == None:
|
||||
return [c + b[0], c + b[1]]
|
||||
return [[c + b[0][0], [*b[0][1], [i, j]]], [c + b[1][0], [*b[1][1], [i, j]]]]
|
||||
if b == None:
|
||||
return [c + r[0], c + r[1]]
|
||||
return [[c + r[0][0], [*r[0][1], [i, j]]], [c + r[1][0], [*r[1][1], [i, j]]]]
|
||||
|
||||
return [c + max(r[0], b[0]), c + min(r[1], b[1])]
|
||||
mmax = max(r[0][0], b[0][0])
|
||||
mmin = min(r[1][0], b[1][0])
|
||||
|
||||
Marr = r[0][1] if mmax == r[0][0] else b[0][1]
|
||||
marr = r[1][1] if mmin == r[1][0] else b[1][1]
|
||||
|
||||
return [[c + mmax, [*Marr, [i, j]]], [c + mmin, [*marr, [i, j]]]]
|
||||
|
||||
|
||||
with open("dat/18-13.csv", 'r') as f:
|
||||
a = [[int(i) for i in row.split(';')] for row in f.readlines()]
|
||||
# with open("24.csv", 'r') as f:
|
||||
a = [[int(i.strip()) for i in row.split(';')] for row in f.readlines()]
|
||||
|
||||
print(count(a, 0, 0))
|
||||
ret = count(a, 0, 0)
|
||||
|
||||
# 1535 330 (не знаю как починить с минимумом)
|
||||
print(ret[0])
|
||||
print(ret[1])
|
||||
|
||||
# 1535 975
|
||||
|
36
18/36.cpp
36
18/36.cpp
@ -1,36 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// 345 (Даже написал на плюсах, не знаю, что с ней не так)
|
||||
|
||||
int main()
|
||||
{
|
||||
ifstream inp("dat/18-17.txt");
|
||||
|
||||
double p = INT8_MAX;
|
||||
double msum = INT8_MIN;
|
||||
double sum = 0;
|
||||
|
||||
while (!inp.eof())
|
||||
{
|
||||
double n;
|
||||
inp >> n;
|
||||
|
||||
if (n < p)
|
||||
{
|
||||
sum += n;
|
||||
if (sum > msum)
|
||||
msum = sum;
|
||||
}
|
||||
else
|
||||
sum = 0;
|
||||
|
||||
p = n;
|
||||
}
|
||||
|
||||
cout << (int)msum << endl;
|
||||
|
||||
return 0;
|
||||
}
|
6
18/36.py
6
18/36.py
@ -1,4 +1,4 @@
|
||||
# 345 (Даже написал на плюсах, не знаю, что с ней не так)
|
||||
# 495 (я дурашка)
|
||||
|
||||
with open('./dat/18-17.txt', 'r') as f:
|
||||
p = float('+inf')
|
||||
@ -12,7 +12,7 @@ with open('./dat/18-17.txt', 'r') as f:
|
||||
if s > ms:
|
||||
ms = s
|
||||
else:
|
||||
s = 0
|
||||
s = n
|
||||
p = n
|
||||
|
||||
print(ms)
|
||||
print(int(ms))
|
||||
|
@ -10,8 +10,10 @@ def count(a, i, j):
|
||||
|
||||
c = a[i][j] if a[i][j] % 3 == 0 or a[i][j] % 4 == 0 else 0
|
||||
|
||||
if l == None and t == None:
|
||||
if l == None and t == None and i == 0 and j == 0:
|
||||
return [c, c]
|
||||
if l == None and t == None:
|
||||
return None
|
||||
if l == None:
|
||||
return [c + t[0], c + t[1]]
|
||||
if t == None:
|
||||
@ -24,4 +26,4 @@ a = [[int(i) for i in row.split(';')] for row in open('dat/18-11.csv', 'r')]
|
||||
|
||||
print(count(a, len(a)-1, len(a[0])-1))
|
||||
|
||||
# 1021 222
|
||||
# 1021 222
|
12
18/dat/18-11.csv
Normal file
12
18/dat/18-11.csv
Normal file
@ -0,0 +1,12 @@
|
||||
24;13;11;50;77;69;74;10;5;98;37;49
|
||||
81;85;55;97;56;93;160;46;45;31;28;51
|
||||
26;97;64;98;59;42;133;74;39;56;12;86
|
||||
11;83;18;93;64;48;5;97;6;14;58;78
|
||||
86;81;432;39;4;2;67;11;16;87;81;46
|
||||
81;17;28;24;18;89;1;10;42;58;39;7
|
||||
74;43;333;10;57;31;90;37;25;499;26;93
|
||||
142;56;45;57;37;13;4;9;34;62;87;94
|
||||
66;20;84;88;34;64;95;45;1;14;51;8
|
||||
37;14;22;16;9;60;38;38;48;24;42;82
|
||||
83;84;98;85;499;48;56;55;90;99;7;3
|
||||
23;64;76;32;65;15;81;57;83;48;61;68
|
|
12
18/dat/18-13.csv
Normal file
12
18/dat/18-13.csv
Normal file
@ -0,0 +1,12 @@
|
||||
58;85;-5;36;7;48;27;100;30;31;94;16
|
||||
47;13;32;46;100;34;144;31;74;96;25;92
|
||||
46;83;144;74;34;346;65;10;-10;20;40;52
|
||||
44;37;39;73;69;78;57;33;-16;40;82;19
|
||||
85;70;6;42;81;3;52;87;345;74;22;30
|
||||
96;23;91;77;333;20;72;120;15;86;48;57
|
||||
17;37;-100;50;87;47;94;62;45;26;34;58
|
||||
63;40;6;53;-22;12;94;53;54;42;1;25
|
||||
40;43;24;61;90;91;90;3;99;74;57;91
|
||||
90;72;123;92;19;58;72;56;28;43;62;59
|
||||
85;62;99;111;51;-91;72;13;54;47;64;94
|
||||
5;12;2;89;33;61;26;64;53;43;109;15
|
|
BIN
18/dat/18-13s.ods
Normal file
BIN
18/dat/18-13s.ods
Normal file
Binary file not shown.
10
18/dat/18-2.csv
Normal file
10
18/dat/18-2.csv
Normal file
@ -0,0 +1,10 @@
|
||||
15;43;23;44;85;19;72;67;36;80
|
||||
100;48;92;64;91;61;71;2;82;74
|
||||
69;9;12;9;91;52;94;58;69;42
|
||||
53;42;18;58;93;55;48;76;18;13
|
||||
49;63;16;13;45;6;81;19;53;63
|
||||
49;53;23;44;61;2;2;63;88;16
|
||||
2;75;100;27;72;64;95;49;51;84
|
||||
64;68;17;16;18;2;30;57;86;6
|
||||
64;84;53;19;23;91;82;2;2;59
|
||||
72;47;56;85;9;26;47;48;91;91
|
|
300
18/dat/18-k1.csv
Normal file
300
18/dat/18-k1.csv
Normal file
@ -0,0 +1,300 @@
|
||||
41
|
||||
104
|
||||
59
|
||||
45
|
||||
156
|
||||
79
|
||||
120
|
||||
137
|
||||
133
|
||||
121
|
||||
186
|
||||
155
|
||||
110
|
||||
162
|
||||
126
|
||||
29
|
||||
21
|
||||
71
|
||||
12
|
||||
66
|
||||
52
|
||||
86
|
||||
101
|
||||
182
|
||||
181
|
||||
168
|
||||
14
|
||||
150
|
||||
72
|
||||
187
|
||||
69
|
||||
20
|
||||
150
|
||||
11
|
||||
39
|
||||
119
|
||||
174
|
||||
120
|
||||
65
|
||||
160
|
||||
17
|
||||
139
|
||||
54
|
||||
72
|
||||
185
|
||||
102
|
||||
181
|
||||
25
|
||||
142
|
||||
65
|
||||
164
|
||||
84
|
||||
160
|
||||
178
|
||||
30
|
||||
100
|
||||
166
|
||||
11
|
||||
57
|
||||
197
|
||||
110
|
||||
95
|
||||
55
|
||||
101
|
||||
38
|
||||
145
|
||||
69
|
||||
88
|
||||
29
|
||||
184
|
||||
135
|
||||
115
|
||||
160
|
||||
86
|
||||
166
|
||||
11
|
||||
39
|
||||
89
|
||||
84
|
||||
200
|
||||
77
|
||||
30
|
||||
135
|
||||
140
|
||||
164
|
||||
54
|
||||
32
|
||||
94
|
||||
100
|
||||
32
|
||||
94
|
||||
168
|
||||
199
|
||||
188
|
||||
104
|
||||
181
|
||||
187
|
||||
77
|
||||
186
|
||||
75
|
||||
46
|
||||
82
|
||||
134
|
||||
67
|
||||
180
|
||||
57
|
||||
27
|
||||
170
|
||||
12
|
||||
158
|
||||
140
|
||||
59
|
||||
75
|
||||
25
|
||||
195
|
||||
108
|
||||
88
|
||||
40
|
||||
173
|
||||
171
|
||||
194
|
||||
31
|
||||
92
|
||||
21
|
||||
67
|
||||
79
|
||||
71
|
||||
80
|
||||
172
|
||||
119
|
||||
147
|
||||
164
|
||||
46
|
||||
10
|
||||
47
|
||||
150
|
||||
160
|
||||
14
|
||||
40
|
||||
116
|
||||
195
|
||||
103
|
||||
39
|
||||
150
|
||||
129
|
||||
100
|
||||
189
|
||||
199
|
||||
124
|
||||
50
|
||||
177
|
||||
34
|
||||
69
|
||||
184
|
||||
141
|
||||
99
|
||||
10
|
||||
51
|
||||
82
|
||||
18
|
||||
60
|
||||
67
|
||||
132
|
||||
129
|
||||
184
|
||||
195
|
||||
91
|
||||
88
|
||||
165
|
||||
125
|
||||
128
|
||||
178
|
||||
119
|
||||
95
|
||||
129
|
||||
171
|
||||
107
|
||||
164
|
||||
38
|
||||
136
|
||||
190
|
||||
154
|
||||
98
|
||||
29
|
||||
180
|
||||
46
|
||||
102
|
||||
159
|
||||
12
|
||||
183
|
||||
167
|
||||
47
|
||||
13
|
||||
40
|
||||
97
|
||||
114
|
||||
126
|
||||
87
|
||||
64
|
||||
147
|
||||
60
|
||||
36
|
||||
121
|
||||
132
|
||||
56
|
||||
146
|
||||
146
|
||||
95
|
||||
196
|
||||
142
|
||||
100
|
||||
63
|
||||
138
|
||||
12
|
||||
129
|
||||
31
|
||||
32
|
||||
45
|
||||
148
|
||||
119
|
||||
196
|
||||
197
|
||||
162
|
||||
21
|
||||
139
|
||||
180
|
||||
49
|
||||
35
|
||||
150
|
||||
146
|
||||
102
|
||||
34
|
||||
200
|
||||
73
|
||||
94
|
||||
129
|
||||
96
|
||||
143
|
||||
86
|
||||
17
|
||||
14
|
||||
156
|
||||
97
|
||||
116
|
||||
175
|
||||
113
|
||||
117
|
||||
196
|
||||
10
|
||||
139
|
||||
93
|
||||
132
|
||||
133
|
||||
134
|
||||
155
|
||||
88
|
||||
186
|
||||
185
|
||||
177
|
||||
94
|
||||
170
|
||||
97
|
||||
165
|
||||
99
|
||||
116
|
||||
96
|
||||
114
|
||||
109
|
||||
27
|
||||
112
|
||||
84
|
||||
114
|
||||
97
|
||||
182
|
||||
124
|
||||
35
|
||||
90
|
||||
144
|
||||
71
|
||||
155
|
||||
177
|
||||
192
|
||||
39
|
||||
47
|
||||
153
|
||||
20
|
||||
86
|
||||
28
|
||||
80
|
||||
147
|
||||
48
|
||||
30
|
||||
58
|
||||
26
|
||||
14
|
||||
175
|
||||
116
|
||||
29
|
||||
85
|
||||
168
|
|
15
18/dat/18-k2.csv
Normal file
15
18/dat/18-k2.csv
Normal file
@ -0,0 +1,15 @@
|
||||
42 100 3 87 2 6 98 19 1 48 59 99 91 33 96
|
||||
15 32 6 94 38 32 74 16 85 7 14 31 4 35 93
|
||||
84 25 59 24 90 25 96 52 8 21 25 3 58 72 6
|
||||
43 38 54 81 37 35 24 98 94 14 62 86 75 47 57
|
||||
6 62 69 56 84 50 89 99 8 18 47 57 38 100 63
|
||||
55 36 34 12 93 77 45 44 84 56 8 25 29 57 60
|
||||
84 35 31 66 21 94 80 52 8 62 55 21 48 69 76
|
||||
10 77 83 82 35 5 24 12 35 35 72 57 34 49 88
|
||||
3 16 96 78 51 92 91 67 79 81 97 26 83 73 37
|
||||
36 95 25 46 91 84 33 82 98 53 8 70 52 39 63
|
||||
6 59 11 11 6 13 83 20 39 65 53 68 4 55 34
|
||||
27 60 15 42 15 24 12 57 20 9 1 79 29 46 60
|
||||
47 52 94 76 42 38 8 24 31 8 61 24 89 52 16
|
||||
92 21 56 57 61 68 41 29 11 62 2 38 27 97 56
|
||||
77 32 95 53 4 95 72 28 69 7 41 89 39 67 12
|
|
1000
18/dat/18-k3.csv
Normal file
1000
18/dat/18-k3.csv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user