Compare commits
2 Commits
070d6dbe3e
...
f51d122a33
| Author | SHA1 | Date | |
|---|---|---|---|
| f51d122a33 | |||
| 5aba700f48 |
@@ -48,7 +48,7 @@ def construct(sections: list[int], target: int) -> dict[int, int]:
|
|||||||
# All modules for CS 412 must include a main method that allows it
|
# All modules for CS 412 must include a main method that allows it
|
||||||
# to imported and invoked from other python scripts
|
# to imported and invoked from other python scripts
|
||||||
def main():
|
def main():
|
||||||
sections: list[int] = list(map(int, input().split(" ")))
|
sections: list[int] = list(map(int, input().split()))
|
||||||
target: int = int(input())
|
target: int = int(input())
|
||||||
|
|
||||||
best_sections = construct(sections, target)
|
best_sections = construct(sections, target)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import sys
|
|||||||
# All modules for CS 412 must include a main method that allows it
|
# All modules for CS 412 must include a main method that allows it
|
||||||
# to imported and invoked from other python scripts
|
# to imported and invoked from other python scripts
|
||||||
def main():
|
def main():
|
||||||
sounds: list[str] = sys.stdin.readline().strip().split(" ")
|
sounds: list[str] = sys.stdin.readline().strip().split()
|
||||||
num_animals: int = int(sys.stdin.readline().strip())
|
num_animals: int = int(sys.stdin.readline().strip())
|
||||||
|
|
||||||
animal_map: dict[str, str] = {}
|
animal_map: dict[str, str] = {}
|
||||||
|
|||||||
@@ -12,18 +12,17 @@ import sys
|
|||||||
# to imported and invoked from other python scripts
|
# to imported and invoked from other python scripts
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
sounds: list[str] = sys.stdin.readline().strip().split(" ")
|
sounds: list[str] = sys.stdin.readline().strip().split()
|
||||||
num_animals: int = int(sys.stdin.readline().strip())
|
num_animals: int = int(sys.stdin.readline().strip())
|
||||||
|
|
||||||
fox_sounds: list[str] = []
|
fox_sounds: list[str] = []
|
||||||
animals_ecountered: list[str] = []
|
animals_ecountered: list[str] = []
|
||||||
|
|
||||||
animal_sounds: list[tuple[str, str]] = list(
|
animal_sounds: list[tuple[str, str]] = []
|
||||||
map(
|
|
||||||
lambda line: line.strip().split(" goes "),
|
for line in sys.stdin.readlines()[:num_animals]:
|
||||||
sys.stdin.readlines()[:num_animals],
|
split_line = line.strip().split(" goes ")
|
||||||
)
|
animal_sounds.append((split_line[0], split_line[1]))
|
||||||
)
|
|
||||||
|
|
||||||
for sound in sounds:
|
for sound in sounds:
|
||||||
animal_found = False
|
animal_found = False
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ def palindrome_partitions(s: str) -> int:
|
|||||||
def main():
|
def main():
|
||||||
n: int = int(input())
|
n: int = int(input())
|
||||||
|
|
||||||
for i in range(0, n):
|
for _ in range(0, n):
|
||||||
in_str = input().strip()
|
in_str = input().strip()
|
||||||
print(palindrome_partitions(in_str))
|
print(palindrome_partitions(in_str))
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ def palindrome_partitions(s: str) -> int:
|
|||||||
def main():
|
def main():
|
||||||
n: int = int(input())
|
n: int = int(input())
|
||||||
|
|
||||||
for i in range(0, n):
|
for _ in range(0, n):
|
||||||
in_str = input().strip()
|
in_str = input().strip()
|
||||||
print(palindrome_partitions(in_str))
|
print(palindrome_partitions(in_str))
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,18 @@ Honor Code and Acknowledgments:
|
|||||||
Comments here on your code and submission.
|
Comments here on your code and submission.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import typing
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
type SquareGrid = np.ndarray[tuple[int, int], np.dtype[np.int64]]
|
||||||
|
|
||||||
def tile(grid: np.ndarray, hole: tuple[int, int]) -> None:
|
|
||||||
|
def tile(grid: SquareGrid, hole: tuple[int, int]) -> None:
|
||||||
|
|
||||||
tile_index = 0
|
tile_index = 0
|
||||||
grid[hole] = -1
|
grid[hole] = -1
|
||||||
|
|
||||||
def recurse(size: int, top: int, left: int, hole: tuple[int, int]) -> None:
|
def recurse(size: int, top: int, left: int, hole: tuple[int, int]) -> None:
|
||||||
if size == 1:
|
if size == 1:
|
||||||
return
|
return
|
||||||
@@ -59,14 +63,15 @@ def tile(grid: np.ndarray, hole: tuple[int, int]) -> None:
|
|||||||
# to imported and invoked from other python scripts
|
# to imported and invoked from other python scripts
|
||||||
def main():
|
def main():
|
||||||
n: int = int(input())
|
n: int = int(input())
|
||||||
x, y = map(int, input().split(" "))
|
x, y = map(int, input().split())
|
||||||
|
|
||||||
grid: np.ndarray = np.zeros((2**n, 2**n), dtype=int)
|
grid: SquareGrid = np.zeros((2**n, 2**n), dtype=np.int64)
|
||||||
|
|
||||||
tile(grid, (x, y))
|
tile(grid, (x, y))
|
||||||
|
|
||||||
for row in grid:
|
for row in grid:
|
||||||
print(" ".join(map(lambda x: f"{x:02d}", row)))
|
row_list = typing.cast(list[int], row.tolist())
|
||||||
|
print(" ".join(map(lambda x: f"{x:02d}", row_list)))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user