Skip to content

Instantly share code, notes, and snippets.

View rkotov93's full-sized avatar

Ruslan Kotov rkotov93

View GitHub Profile
@rkotov93
rkotov93 / lab21.c
Created June 4, 2011 17:43
Long Math
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NMAX 1002
void invert(int*); // Инвертирует число
void sum(int*, int*); // Суммирует два числа
int max(int, int); // Возвращает максимальное число
int* divide (int*, int);
@rkotov93
rkotov93 / lab22.c
Created June 5, 2011 15:45
Search Small Distance
#include <stdio.h>
#include <limits.h>
#include <malloc.h>
#define side 200
typedef struct coordinates {
int i;
int j;
} coord;
@rkotov93
rkotov93 / labirint2.c
Created June 15, 2011 19:27
Fast search short distance
#include <stdio.h>
#include <malloc.h>
#include <limits.h>
#define side 200
#define h 0
#define w 1
typedef struct coordinates {
int i;
@rkotov93
rkotov93 / z.c
Created June 26, 2011 10:25
task
#include <stdio.h>
#include <limits.h>
int upOrder(int n) {
int k;
int f = n % 10;
n /= 10;
while (n > 0) {
k = n % 10;
@rkotov93
rkotov93 / user.rb
Created July 13, 2011 20:23
User model (sample_app)
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# name :string(255)
# email :string(255)
# created_at :datetime
# updated_at :datetime
#
@rkotov93
rkotov93 / ariph.c
Created August 30, 2011 22:31
olymp2007_ariph
#include <stdio.h>
#include <malloc.h>
void sum(int, int, int, int, long long*);
void multiplication(int, int, int, int, long long*);
int lcm(int, int); // lowest common multiple
int main() {
int p1, q1, p2, q2;
long long* ans = (long long*)malloc(2*sizeof(long long)); // answer
@rkotov93
rkotov93 / pr.c
Created September 21, 2011 13:12
problem
#include <stdio.h>
#include <malloc.h>
#include <limits.h>
int minNum(int* str, int m) {
int min = INT_MAX;
int i;
for (i = 0; i < m; i++) {
//printf("%d", str[i]);
@rkotov93
rkotov93 / cifra.c
Created September 27, 2011 17:28
olymp2007_cifra
#include <stdio.h>
int evenFact(int n) {
int i;
int lastNum = 1;
for (i = 2; i <= n; i += 2) {
if (lastNum == 0) return lastNum;
lastNum = (lastNum * (i % 10)) % 10;
}
@rkotov93
rkotov93 / anagr.c
Created October 3, 2011 11:45
olymp2007_anagr
#include <stdio.h>
#include <string.h>
#include <malloc.h>
int main() {
int* word;
int wordLen = -1;
int* anaWord;
int anaWordLen = -1;
int i, j = 0;
@rkotov93
rkotov93 / geocode_method.js.coffee
Created November 6, 2011 20:14
CoffeeScript closures
class window.MapHandler
map = null
makeMap: () ->
latlng = new google.maps.LatLng(54.711929,20.5089);
myOptions =
zoom: 12
center: latlng
mapTypeId: google.maps.MapTypeId.ROADMAP
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions)