This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
[[0, 0], | |
[0, 1]], | |
[[0, 1], | |
[1, 1]] | |
] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== Запуск === | |
Чтобы запустить программу выполните файл main.exe | |
Когда программа закончит работу нажмите <Enter> чтобы выйти. | |
=== Описание === | |
Программа для проверки полурешеток на изоморфизм. | |
=== Вход === | |
Входные данные: фалй input.txt содержаший две таблицы для полурешеток. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Number < Struct.new(:value) | |
def to_s | |
value.to_s | |
end | |
def inspect | |
"\"#{self}\"" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.IO | |
import Control.Monad | |
import Data.Tree | |
import Data.List | |
import System.Environment | |
------------------------------------------------------------------------------- | |
encodeTree (Node root []) = "01" | |
encodeTree (Node root childs) = "0" ++ intercalate "" (sort $ map encodeTree childs) ++ "1" | |
isIsomorphic t1 t2 = encodeTree t1 == encodeTree t2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
a = [] | |
def go(s, c0, c1, n): | |
if c0 + c1 == 2*n: | |
a.append(s) | |
elif c0 == 0 or c0 == c1: | |
go(s + "0", c0+1, c1, n) | |
elif c0 == n: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
a = [] | |
def go(s, c0, c1, n): | |
if c0 + c1 == 2*n: | |
a.append(s) | |
elif c0 == 0 or c0 == c1: | |
go(s + "0", c0+1, c1, n) | |
elif c0 == n: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/400794/generating-the-partitions-of-a-number | |
def partitions(n): | |
if n == 0: yield [] | |
if n <= 0: return | |
for p in partitions(n-1): | |
if len(p) == 1 or (len(p) > 1 and p[-1] < p[-2]): | |
p[-1] += 1 | |
yield p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List (genericIndex) | |
a027750 n k = a027750_row n !! (k-1) | |
a027750_row n = filter ((== 0) . (mod n)) [1..n] | |
a027750_tabf = map a027750_row [1..] | |
a000081 = genericIndex a000081_list | |
a000081_list = 0 : 1 : f 1 [1, 0] where | |
f x ys = y : f (x + 1) (y : ys) where | |
y = sum (zipWith (*) (map h [1..x]) ys) `div` x | |
h = sum . map (\d -> d * a000081 d) . a027750_row |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://repl.it/BnaK | |
t_ran_poz = [(0,0),(8,9),(17,40),(13,13),(20,20),(23,26),(29,29),(33,43),(37,38),(42,42),(48,48),(61,61)] | |
rabots = [(0,1,8),(0,3,13),(0,4,9),(1,2,9),(1,3,4),(1,5,6),(2,7,3),(3,4,7),(3,5,10),(3,6,6), | |
(4,6,9),(4,8,10),(4,9,6),(5,6,3),(5,7,8),(6,7,4),(6,8,8),(6,9,13),(6,10,5),(7,10,5), | |
(8,9,4),(9,10,6),(9,11,17),(10,11,13)] | |
# Сроки начала и окночания работ | |
t_ran_nach = [t_ran_poz[r[0]][0] for r in rabots] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env=Environment(CPPPATH='/usr/include/boost/', | |
CPPDEFINES=[], | |
LIBS=[], | |
SCONS_CXX_STANDARD="c++11" | |
) | |
env.Program('Hello', Glob('src/*.cpp')) |