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 <stdio.h> | |
#include <stdlib.h> | |
#include <sys/mman.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
int main() | |
{ | |
/* head -c 8G </dev/urandom > /tmp/random.bin */ |
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 <thrust/iterator/counting_iterator.h> | |
#include <thrust/device_vector.h> | |
#include <thrust/transform.h> | |
#include <thrust/random.h> | |
#include <iostream> | |
template <typename T, typename D, typename E = thrust::default_random_engine> | |
struct device_random_generator | |
{ |
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
#! /usr/bin/env python | |
# -*- coding: utf-8 -* | |
# Simplex algorithm | |
# Generate simplex tables | |
# [Draft] | |
# TODO: | |
# 1. Make some tests | |
# 2. Format output |
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
%pdflatex nf.tex | |
\documentclass[12pt]{article} | |
\usepackage{fullpage} | |
\usepackage{multicol,multirow} | |
\usepackage{tabularx} | |
\usepackage{ulem} | |
\usepackage{amssymb} | |
\usepackage[utf8]{inputenc} | |
\usepackage[russian]{babel} |
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
#! /usr/bin/env python | |
import numpy as np | |
import matplotlib.pyplot as plt | |
sz = int(raw_input()) | |
a = np.random.normal(size = sz) | |
b = np.random.normal(size = sz) | |
x_n = list(np.cumsum([ x / y for x, y in zip(a, b) ])) |
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 <algorithm> | |
#include <iterator> | |
#include <iostream> | |
#include <cstdio> | |
#include <string> | |
#include <vector> | |
#include <queue> | |
#include <map> | |
/* Aho–Corasick string matching algorithm implementation */ |
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
#! /usr/bin/env bash | |
# This works for me with Ubuntu 12.04, Samsung 27A950 and NVIDIA GeForse GT 520M: | |
#~$ uname -a | |
#Linux ubuntu 3.2.0-45-generic #70-Ubuntu SMP Wed May 29 20:12:06 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux | |
#~$ optirun --version | |
#optirun (Bumblebee) 3.2.1 | |
# How to use algorithm: | |
# Start HDMI output: |
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
Лабораторная работа №8. Жадные алгоритмы | |
Вариант: Выбор отрезков | |
На координатной прямой даны несколько отрезков с координатами [Li, Ri ]. Необходимо выбрать минимальное количество отрезков, которые бы полностью покрыли интервал [0, M ]. | |
Входные данные: на первой строчке располагается число N, за которым следует N строк на каждой из которой находится пара чисел Li, Ri ; последняя строка содержит в себе число M . | |
Выходные данные: на первой строке число K выбранных отрезков, за которым следует K строк, содержащих в себе выбранные отрезки в том же порядке, в котом они встретились во входных данных. Если покрыть интервал невозможно, нужно распечатать число 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
Лабораторная работа №7. Динамическое программирование | |
Вариант: Хитрый рюкзак | |
У вас есть рюкзак, вместимостью m, а так же n предметов, у каждого из которых есть вес wi и стоимость ci. Необходимо выбрать такое подмножество I из них, чтобы: | |
* Σi∈Iwi ≤ m | |
* (Σi∈Ici)*|I| является максимальной из всех возможных. | |
|I| – мощность множества I. | |
Входные данные: в первой строке заданы 1 ≤ n ≤ 100 и 1 ≤ m ≤ 5000. В последующих n строках через пробел заданы параметры предеметов: wi и ci. | |
Выходные данные: в первой строке необходимо вывести одно число – максимальное значение (Σi∈Ici)*|I|, а на второй – индексы предметов, входящих в ответ. |
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 <algorithm> | |
#include <stdexcept> | |
#include <iostream> | |
#include <iomanip> | |
#include <sstream> | |
#include <limits> | |
#include <string> | |
#include <vector> | |
/* Based on http://cppalgo.blogspot.co.uk/2010/05/blog-post.html */ |
NewerOlder