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
countChange :: Int -> [Int] -> Int | |
countChange money coins = | |
let | |
applyFactors factors = (if (sum $ zipWith (*) coins factors) == money then 1 else 0) + | |
if all (== money) factors then 0 | |
else | |
applyFactors (nextFactors factors) | |
where | |
nextFactors (x : xs) | |
| x == money = 0 : (nextFactors xs) |
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
countChange :: Int -> [Int] -> Int | |
countChange 0 _ = 1 | |
countChange _ [] = 0 | |
countChange money coins@(x:xs) | |
| money < 0 = 0 | |
| otherwise = (countChange money xs) + (countChange (money - x) coins) |
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
QList<QList<File*>*> fileLists { &this->filesWithoutHashesPrioritized, &this->filesWithoutHashes }; |
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 System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Net; | |
using DBus; | |
namespace IPChangerPrototype | |
{ | |
public enum Method |
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 System; | |
namespace ExperimentationsCSharp | |
{ | |
public struct IntString : IEquatable<IntString>, IComparable<IntString> | |
{ | |
int value; | |
public IntString(int v) | |
{ |
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
open System | |
let rec readAge () : int = | |
printf "Age: " | |
match Int32.TryParse(Console.ReadLine()) with | |
| true, age when age > 0 -> age | |
| _ -> | |
printfn "Cannot read the age, please retry.." | |
readAge () | |
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 fsharpi | |
let elements = [ "M", 1000; "CM", 900; "D", 500; "CD", 400; "C", 100; "XC", 90; "L", 50; "XL", 40; "X", 10; "IX", 9; "V", 5; "IV", 4; "I", 1 ] | |
let rec toRomanNumber (v : int) : string = | |
if v >= 1 then | |
let e, v' = elements |> List.find (snd >> (>=) v) | |
e + toRomanNumber (v - v') | |
else | |
"" |
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
p=< 3,0,0>, v=< 2,0,0>, a=<-1,0,0> -4 -3 -2 -1 0 1 2 3 4 | |
p=< 4,0,0>, v=< 0,0,0>, a=<-2,0,0> (0)(1) | |
p=< 4,0,0>, v=< 1,0,0>, a=<-1,0,0> -4 -3 -2 -1 0 1 2 3 4 | |
p=< 2,0,0>, v=<-2,0,0>, a=<-2,0,0> (1) (0) | |
p=< 4,0,0>, v=< 0,0,0>, a=<-1,0,0> -4 -3 -2 -1 0 1 2 3 4 | |
p=<-2,0,0>, v=<-4,0,0>, a=<-2,0,0> (1) (0) | |
p=< 3,0,0>, v=<-1,0,0>, a=<-1,0,0> -4 -3 -2 -1 0 1 2 3 4 |
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
p=<-3787,-3683,3352>, v=<41,-25,-124>, a=<5,9,1> | |
p=<6815,2269,3786>, v=<-93,23,38>, a=<-8,-6,-10> | |
p=<-1586,-5016,3166>, v=<2,66,-70>, a=<3,6,-2> | |
p=<-2392,-397,3538>, v=<76,-19,-114>, a=<0,2,0> | |
p=<1669,1370,376>, v=<41,68,-28>, a=<-6,-7,1> | |
p=<-3601,3943,-6010>, v=<35,-79,-30>, a=<5,-3,14> | |
p=<1235,3943,-771>, v=<-57,-31,41>, a=<1,-6,-1> | |
p=<-1925,-314,1287>, v=<80,16,-73>, a=<1,0,1> | |
p=<3325,5104,720>, v=<-5,-55,-68>, a=<-14,-17,3> | |
p=<-1841,1744,615>, v=<76,61,-8>, a=<1,-13,-2> |
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
p=<1500,413,-535>, v=<-119,22,36>, a=<-5,-12,3> | |
p=<65,1223,-530>, v=<-14,-136,52>, a=<2,2,0> | |
p=<260,-387,800>, v=<49,14,-103>, a=<-13,4,4> | |
p=<429,726,462>, v=<-36,-36,-19>, a=<0,-6,-4> | |
p=<1705,-165,1331>, v=<-134,9,-104>, a=<-3,0,-3> | |
p=<341,693,-473>, v=<-28,9,-18>, a=<0,-13,10> | |
p=<2816,-2250,1464>, v=<-91,41,149>, a=<-4,6,-20> | |
p=<-1237,-1704,-531>, v=<47,125,35>, a=<1,-4,-1> | |
p=<-4828,-171,-447>, v=<86,8,-24>, a=<13,0,4> | |
p=<2553,3286,-5524>, v=<-128,45,41>, a=<3,-9,8> |
OlderNewer