-
Sprawdzamy czy drzewo jest drzewem AVL
struct Node { Node *left, *right; int val; }
This file contains 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> | |
#define ULL unsigned long long | |
using namespace std; | |
ULL tenn(ULL n) { | |
ULL w=1,ten=1; | |
while(w<=n) { | |
w*=5; ten*=10; | |
} | |
return ten; |
This file contains 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
#jtp | |
%: %.c | |
gcc -Wall -O2 -ansi -pedantic -std=c99 -lm -o bin/$@ $< | |
#wdi | |
%: %.cpp | |
g++ -O2 $< -o bin/$@ |
This file contains 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 org.jasig.cas.authentication.principal.UsernamePasswordCredentials; | |
import org.springframework.security.crypto.bcrypt.BCrypt; | |
import org.springframework.beans.factory.InitializingBean; | |
import org.jasig.cas.adaptors.jdbc.AbstractJdbcUsernamePasswordAuthenticationHandler; | |
/** | |
* Class that given a table, username field and password field will query a | |
* database table to see if the user exists. If the user exists, the | |
* encrypted password, from the datbase, will be compared to the plain | |
* text password, from the credentials, by using the BCrypt tools. |
This file contains 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
# To be added in proper place | |
pl: | |
date: | |
genitive_month_names: | |
- | |
- stycznia | |
- lutego | |
- marca | |
- kwietnia | |
- maja |
This file contains 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
/*Zad. 1 Dana jest duża tablica typu tab=array[1..n] of integer. Proszę napisać funkcję, która | |
zwraca informację, czy w tablicy zachodzi następujący warunek: „wszystkie elementy, których | |
indeks jest elementem ciągu Fibonacciego są liczbami złożonymi, a wśród pozostałych | |
przynajmniej jedna jest liczbą pierwszą”. | |
Uwagi: | |
• Czas na rozwiązanie zadania wynosi 25 minut, za zadanie można otrzymać 5 punktów. | |
• Oceniane będą: przejrzystość i czytelność kodu oraz efektywność rozwiązania.*/ | |
#include<cstdio> | |
using namespace std; |
This file contains 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
/* | |
1. Mamy tablicę [1..max,1..max]. Napisz funkcję, która zwraca długość najdłuższego podciągu | |
rosnącego znajdującego się w dowolnym (jednym) wierszu, którego wszystkie elementy są ze sobą | |
względnie pierwsze. | |
*/ | |
#include<cstdio> | |
#include<algorithm> | |
using namespace std; |
This file contains 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
/* | |
Mamy dany zbiór punktów. | |
type | |
punkt=record | |
x:integer; | |
y:integer; | |
end; | |
tab=array[1..max] of punkt; | |
Napisz funkcję, która zwróci najmniejszą odległość między środkami ciężkości 2 niepustych podzbiorów | |
tego zbioru. |
This file contains 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
# Using comma as decimal separator in Rails 4 based on | |
# http://stjhimy.com/posts/11-using-comma-as-decimal-separator | |
ActiveRecord::ConnectionAdapters::Column.class_eval do | |
class << self | |
def value_to_float(value) | |
if value.class == Float | |
value | |
elsif value.class == String | |
value.gsub(',', '.').to_f |
This file contains 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 ruby | |
# Skrypcik konwerujący zbugowany eksport do GoogleCalendar z Enrollme | |
# 9:35 - 11:05 -> 9:30 - 11:00 | |
# 12:50 - 14:20 -> 12:45 - 14:15 | |
# 14:40 - 16:10 -> 14:30 - 16:00 | |
# 17:50 - 19:20 -> 17:45 - 19:15 | |
TIME_MAPPING = { | |
'(DTSTART:.+)(T093000)(Z)' => 'T093500', | |
'(DTEND:.+)(T110000)(Z)' => 'T110500', | |
'(DTSTART:.+)(T124500)(Z)' => 'T125000', |
OlderNewer