Skip to content

Instantly share code, notes, and snippets.

program zadacha1;
uses Math;
var
x : integer;
function z(x : integer) : real;
var y : real;
begin
@YoukaiCat
YoukaiCat / data_module.pas
Created April 18, 2012 12:51
Runtime connection
// Returns a full path to the current dir
function currentDirPath():String;
begin
result:=extractFileDir(expandFileName('anything'));
end;
// Makes connection string at runtime.
// it's necessary because delphi don't understand relative paths.
procedure TDataModule.ADOConnectionBeforeConnect(Sender: TObject);
begin
@YoukaiCat
YoukaiCat / zadacha.hs
Created April 18, 2012 11:43
Решение простой задачи на различных языках
-- Найти все натуральные числа a,b,c из интервала от 1 до 20,
-- для которых выполняется равенство c2 = b*a2
numbers :: [(Int, Int, Int)]
numbers = [ (a,b,c) | a <- [1..20], b <- [1..20], c <- [1..20], c * 2 == b * a * 2 ]
main :: IO ()
main = mapM_ printParams numbers
where
printParams (a,b,c) = putStrLn $ "a = " ++ show a ++ ", b = " ++ show b ++ ", c = " ++ show c