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
| apply plugin: 'com.android.application' | |
| android { | |
| compileSdkVersion 19 | |
| buildToolsVersion "23.0.2" | |
| defaultConfig { | |
| applicationId "com.sabal.helloopencv" | |
| minSdkVersion 15 | |
| targetSdkVersion 19 |
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
| def insertion_sort(arr, reversed=False): | |
| for i in range(1, len(arr)): | |
| key = arr[i] | |
| j = i - 1 | |
| if reversed: | |
| while j >= 0 and arr[j] < key: | |
| arr[j + 1] = arr[j] | |
| j -= 1 | |
| else: | |
| while j >= 0 and arr[j] > key: |
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 re | |
| n = int(input()) | |
| num = re.compile("[-0-9]+") | |
| states = dict() | |
| for i in range(n): | |
| line = input().rstrip().replace("<", " ").split() | |
| print(line) | |
| if len(line) == 0: |
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
| #include <iostream> | |
| #include <algorithm> | |
| using namespace std; | |
| #define forn(i, n) for(int i = 0; i < (n); ++i) | |
| typedef pair<long long, long long> pt; | |
| #define x first | |
| #define y second |
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
| N = int(input()) + 1 | |
| A = [True]*(N) | |
| for k in range(2, N): | |
| if A[k]: | |
| print(k, end=" ") | |
| for i in range(k*k, N, k): | |
| A[i] = False | |
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
| # | |
| def s(n): | |
| m = 0 | |
| while n > 0: | |
| m += n % 10 | |
| n //= 10 | |
| return m | |
| def l(n): | |
| m = 0 |
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
| from math import ceil, sqrt | |
| class FuncCounter: | |
| """Класс-обертка для функции, который выглядит как функция | |
| Метод __call__ вызывается, когда вызываешь экземпляр обертки как ф-ю | |
| Класс хранит все вызовы функции и их результаты в словаре self.calls | |
| В атрибуте counter хранится количество уникальных вызовов функции func | |
| """ |
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
| def print_rangoli(size): | |
| from string import ascii_lowercase | |
| alph = ascii_lowercase[:size] | |
| main_line = alph[::-1] + alph[1:] | |
| for i in list(range(1, size)) + list(range(size, 0, -1)): | |
| s = main_line[:i] + main_line[2 * size - i:] | |
| print('{x:-^{size}}'.format(x='-'.join(s), size=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
| def designer_door_mat(n, m): | |
| f = '.|.' | |
| w = "WELCOME" | |
| for i in range(1, n - 1, 2): | |
| print("{x:-^{size}}".format(x=f * i, size=m)) | |
| print("{x:-^{size}}".format(x=w, size=m)) | |
| for i in range(n - 2, 0, -2): | |
| print("{x:-^{size}}".format(x=f * i, size=m)) |
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
| def minion_game(string): | |
| s = string | |
| n = len(s) | |
| stuart = kevin = 0 | |
| for i in range(n): | |
| if s[i] in 'AEIOU': | |
| kevin += n - i | |
| else: | |
| stuart += n - i | |
| if kevin == stuart: |
OlderNewer