Skip to content

Instantly share code, notes, and snippets.

View maestroviktorin's full-sized avatar

Viktor Starodubtsev maestroviktorin

View GitHub Profile
@maestroviktorin
maestroviktorin / normal_distribution_hypothesis.rs
Created May 17, 2025 22:35
Algorithm to determine if the sample can be a sample of a Normal Distribution.
//! Algorithm for solving problems of the following kind.
//!
//! Given: `significance` ratio, empirical sample, theoretical sample.
//! To figure out: Is it appropriate to assume that the sample is a sample of a Normal Distribution?
use statrs::distribution::{ChiSquared, ContinuousCDF};
fn main() {
let e: Vec<_> = [7, 12, 49, 66, 83, 67, 23, 13]
.iter()
digraph Automata {
// Default parameters for all nodes and edges.
node [shape=circle fontname="Arial"];
edge [fontname="Arial"]
{rank=same 2 3}
// Identifier.
S -> 2 [label=" a...z0...9"]
2 -> 2 [label=" a...z0...9"]
2 -> 3 [label=" ["]
@maestroviktorin
maestroviktorin / computer-organization-1.cpp
Last active February 25, 2024 10:49
Computer Organization Laboratory Work #1.
#include <iostream>
#include <string>
static int calculate(int a, int b, int c, int d)
{
int result = 0;
// (4*a + 52 - 9*b) / (c - 84/(d*a))
__asm {
; a * 4
@maestroviktorin
maestroviktorin / aoc-2.rs
Created December 22, 2023 22:04
Advent of Code 2023. Challenge 2.
/*
Advent of Code 2023. Challenge 2.
*/
use regex;
use std::fs::read_to_string;
const RED: usize = 12;
const GREEN: usize = 13;
const BLUE: usize = 14;
from random import randint
def print_info():
information = \
"""
Лабораторная работа № 2
Вариант № 20. Выполнил студент группы 6104-020302D Стародубцев Виктор
1. В списке целочисленных элементов найти максимальный нечётный элемент
2. С использованием цикла `while` найти в списке индекс последнего
@maestroviktorin
maestroviktorin / task-8432.py
Last active May 15, 2023 20:04
Solution to the problem #8432 from kompege.ru
# Problem No. 8432 on https://www.kompege.ru
class Vehicle:
'''
Kind of struct describing a vehicle.
'''
def __init__(self, start: int, duration: int, _type: str):
self.start = start
self.end = start + duration
@maestroviktorin
maestroviktorin / task-7709.py
Last active May 15, 2023 19:57
Solution to the problem #7709 from kompege.ru
# Problem No. 7709 on https://www.kompege.ru
def does_not_intercept(pair_a: tuple[int, int], pair_b: tuple[int, int]) -> bool:
return all(x < pair_b[0] for x in pair_a) or all(x > pair_b[1] for x in pair_a)
with open('26_7709.txt') as file:
rows = file.readlines()
K = int(rows[0])
@maestroviktorin
maestroviktorin / task-6092.py
Created April 14, 2023 20:57
Solution to the problem #6092 from the website of K. Polyakov.
with open('26-101.txt') as file:
rows = file.readlines()
N, K = tuple(int(x) for x in rows[0].split())
crates = sorted((int(x) for x in rows[1:]), reverse=True)
blocks = list()
while crates:
block = [crates.pop(0)]
@maestroviktorin
maestroviktorin / task-6040.py
Created April 14, 2023 10:00
Solution to the problem #6040 by A. Rogov from the website of K. Polyakov.
with open('26-100.txt') as file:
rows = file.readlines()
N, M = tuple(int(x) for x in rows[0].split())
pipes = sorted(int(x) for x in rows[1:])
for i in range(N):
pipeline = [pipes[i]]
@maestroviktorin
maestroviktorin / task-4322.py
Created January 29, 2023 19:23
Solution to the problem #4322 by /dev/inf from kompege.ru
"""
Solution to the problem No. 4322 by /dev/inf from kompege.ru
`10.txt` is a text file in which the beginning and each line of type `Глава \d+`
must be deleted manually in the Notebook for example.
"""
import re