Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projecteuler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
projecteuler
Commits
40eab4bf
Commit
40eab4bf
authored
Dec 20, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
46eb33ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
22 deletions
+9
-22
problem29.py
problem29.py
+1
-10
problem81.py
problem81.py
+8
-12
No files found.
problem29.py
View file @
40eab4bf
#!/usr/bin/env python
#!/usr/bin/env python
def
combos
(
A
,
B
):
print
len
(
set
(
a
**
b
for
b
in
range
(
2
,
101
)
for
a
in
range
(
2
,
101
)))
c
=
set
()
for
a
in
A
:
for
b
in
B
:
c
.
add
(
a
**
b
)
return
sorted
(
c
)
print
len
(
combos
(
range
(
2
,
101
),
range
(
2
,
101
)))
problem81.py
View file @
40eab4bf
#!/usr/bin/env python
#!/usr/bin/env python
from
numpy
import
array
m
=
[
map
(
int
,
line
.
split
(
','
))
for
line
in
open
(
'matrix.txt'
,
'r'
).
readlines
()]
h
,
w
=
len
(
m
),
len
(
m
[
0
])
m
=
array
([
l
.
split
(
','
)
for
l
in
open
(
'matrix.txt'
,
'r'
).
readlines
()],
dtype
=
int
)
h
,
w
=
m
.
shape
def
add
(
x
,
y
):
def
add
(
x
,
y
):
global
m
global
m
p
=
[]
p
=
[]
if
x
:
p
.
append
(
m
[
y
,
x
-
1
])
if
x
:
p
.
append
(
m
[
y
][
x
-
1
])
if
y
:
p
.
append
(
m
[
y
-
1
,
x
])
if
y
:
p
.
append
(
m
[
y
-
1
][
x
])
m
[
y
,
x
]
+=
min
(
p
)
m
[
y
][
x
]
+=
min
(
p
)
for
i
in
range
(
w
+
h
):
for
i
in
xrange
(
w
+
h
):
for
x
in
range
(
i
+
1
):
for
x
in
x
range
(
i
+
1
):
y
=
i
-
x
y
=
i
-
x
if
(
x
or
y
)
and
x
<
w
and
y
<
h
:
if
(
x
or
y
)
and
x
<
w
and
y
<
h
:
add
(
x
,
y
)
add
(
x
,
y
)
print
m
[
h
-
1
,
w
-
1
]
print
m
[
h
-
1
][
w
-
1
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment