Skip to content

Instantly share code, notes, and snippets.

View flutesa's full-sized avatar

Alexandra Burkova flutesa

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>Испытание: формы — вспомнить всё</title>
<meta charset="utf-8">
</head>
<body>
<form action="/echo" method="post">
<label for="name-field">Имя</label>
<input type="text" id="name-field" name="name">
@flutesa
flutesa / st2.py
Created February 6, 2014 13:10
Lingua
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import codecs
import re
def read_file(fileName):
f = codecs.open(fileName,'r','utf8')
source_text = f.read()
f.close()
@flutesa
flutesa / C O(n)
Last active January 4, 2016 09:09
#n = 10
#t1, t2 = 1, 2
#a, b, c, d = 0, 1, 1, 11
f = open('treasure.in', 'r')
n = int(f.readline())
t1, t2 = list(map(int, f.readline().split(" ")))
a, b, c, d = list(map(int, f.readline().split(" ")))
f.close()
from random import *
def find_first(array, element): #[l, r) first entry element
l = -1
r = len(array)
while l + 1 < r:
m = (l + r)//2
if array[m] >= element:
r = m
def isAnswer(m, n, x, y):
return (m//x) + (m//y) >= n
def find(n, x, y):
l = 0
r = n * x
while l + 1 < r:
m = (l + r)//2
if isAnswer(m, n, x, y):
def isAnswer(w, h, n, m):
return (m//w) * (m//h) >= n
def find(w, h, n):
l = 0
r = 10**18
while l + 1 < r:
m = (l + r)//2
if isAnswer(w, h, n, m):
def isAnswer(array, k, checked):
last = -1
count = 0
for i in range(len(array)):
if last == -1 or array[i] - array[last] >= checked:
count += 1
last = i
return count >= k
#Задача B. Наименьший нечетный
# ok 1) если все элементы в массиве чётные - выведи 0
# ok 2) вывести наименьшее нечётное
a = list(map(int, input().split()))
a = [0, 4, 5, 1, 7, 3]
counter = 0