This file contains 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
<figure> | |
<figcaption> | |
Percentage of world population by continent | |
</figcaption> | |
<div class="buttons"></div> | |
<svg width="300" height="300" viewBox="0 0 32 32" class="chart"> | |
<circle r="16" cx="16" cy="16" class="pie"/> | |
</svg> | |
</figure> |
This file contains 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
$primaryColor: #0074d9; | |
circle { | |
fill: #ddd; | |
stroke: $primaryColor; | |
stroke-width: 32; | |
stroke-dasharray: 50 100; | |
transition: stroke-dasharray .3s ease; | |
} |
This file contains 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
def get_length_square(p1, p2): | |
return (p1[0]-p2[0])**2 + (p1[1] - p2[1])**2 | |
def check_angle(p1, p2, p3): | |
return get_length_square(p1, p3) == get_length_square(p1, p2) + get_length_square(p2, p3) | |
def count_right_angles(coords): | |
count = 0 | |
if check_angle(coords[0],coords[1],coords[2]): | |
count = count + 1 |
This file contains 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
const sum = (arr, start, count) => arr.slice(start, start + count).reduce((res, val) => res + val, 0); | |
const solve = (n, a, b, c) => { | |
let i = 0; | |
let res = 0; | |
while(i < n) { | |
if (sum(a, i, 2) && b[i] + a[i + 1] > c[i]) { | |
res += c[i]; | |
i += 3; | |
} else if (sum(a, i, 1) > b[i]) { |
This file contains 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
#Uses python3 | |
import sys | |
def bigger_than(a, b): | |
return (a + b) > (b + a) | |
def find_biggest_index(a): | |
max_index = 0 | |
for i in range(len(a)): |
This file contains 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
def get_major(items): | |
map = {} | |
major_count = round(len(items) / 2) | |
for item in items: | |
if map.get(item): | |
if map[item] + 1 >= major_count: | |
return item | |
map[item] = map[item] + 1 | |
else: | |
map[item] = 1 |
This file contains 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
def step(mins, n): | |
if n == 1: | |
return 0 | |
if (mins[n] != -1): | |
return mins[n] | |
result = 1 + step(mins, n-1) | |
if (n % 2 == 0): | |
result = min(result, 1 + step(mins, n // 2)) | |
if (n % 3 == 0): |
This file contains 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
# Uses python3 | |
# собираем граф из массива | |
def build_graph(arr, fin): | |
graph = {} | |
for node in arr: | |
if not graph.get(node[0]): | |
graph[node[0]] = {} | |
graph[node[0]][node[1]] = node[2] / 100 | |
if not graph.get(node[1]): |
This file contains 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
(function() { | |
var currentFilter = { | |
roomCount: 'any', | |
type: 'any', | |
price: '0' | |
}; // <-- объект который будет храить текущее состояние всех фильтров | |
var filterByRooms = function(offer, roomCount) { | |
if (roomCount === 'any') { | |
return true; // <-- показываем элемент если количество комнат не задано |
This file contains 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
/** | |
* Суть решения: Сначала пробигаемся с начала матрица до конца заполняя левое и верхнее направлевление | |
* для выйграша. Для этого сравниваем текущее и предыдущее значения по этому направлению и проверяем было ли | |
* предыдущее значение выиграшным по этому направлению. Если да, то проверять дальше бессмысленно, то что они | |
* в любом случае будут меньше текущего значения, иначе предверяем следующее число в том же направлении. | |
* | |
* После того как закончим прверять все верхнии и левые значения переходим к нижних правым. Для этого делаем тоже самое | |
* но в обратном направлении. Заодно и складываем сумму. | |
*/ |
OlderNewer