This file contains hidden or 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
| from fractions import Fraction | |
| def fraccionalizar(mat): | |
| for f in xrange(len(mat)): | |
| for c in xrange(len(mat[0])): | |
| mat[f][c] = Fraction(mat[f][c]) | |
| return mat | |
| def mostrar(mat): | |
| for f in mat: |
This file contains hidden or 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
| /* | |
| La primera idea que se me vino a la mente para | |
| http://channel9.msdn.com/Events/GoingNative/2013/The-Way-of-the-Exploding-Tuple | |
| No recomendaria su uso, pero es otra forma de atacar al reto. | |
| */ | |
| #include <cstring> | |
| #include <tuple> |
This file contains hidden or 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 <utility> | |
| #include <typeinfo> | |
| struct Base { | |
| virtual int f() = 0; | |
| }; | |
| struct Derived1 : public Base { | |
| virtual int f() final override { | |
| return 42; |
This file contains hidden or 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 std.stdio, std.typetuple, std.traits; | |
| template maxexp(T, uint base, T acc = T.max, uint i = 0) | |
| if (isIntegral!T && base > 1) | |
| { | |
| static if (acc == 0) | |
| { | |
| enum maxexp = i - 1; | |
| } | |
| else |
This file contains hidden or 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 std.stdio, std.conv, std.array, std.algorithm, std.file, std.numeric, std.range, std.math; | |
| ulong rows(T)(T m) { return m.length; } | |
| ulong cols(T)(T m) { return m[0].length; } | |
| struct Matrix(T) | |
| { | |
| immutable ulong rows, cols; | |
| T[] data; | |
This file contains hidden or 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
| {-# LANGUAGE BangPatterns #-} | |
| import System.Environment | |
| import qualified Data.Vector.Unboxed as V | |
| import Debug.Trace (traceShowId) | |
| trace x = traceShowId x | |
| data Matrix a = Mat !Int !Int (V.Vector a) |
This file contains hidden or 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 requests as http | |
| import random, re, time, datetime | |
| __baseurl__ = 'http://arquerodelreybk.com' | |
| __targets__ = ['Left', 'LeftUp', 'Center', 'Right', 'RightUp'] | |
| __prizes__ = ['Refresco King', 'Sundae', 'Whopper Jr.', 'Papas Super King', 'Rodeo'] | |
| def make_url(path): | |
| return __baseurl__ + path |
This file contains hidden or 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 <unistd.h> | |
| #include <pthread.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| long ntimes = 0; | |
| char data[] = {'0', '1'}; | |
| // llamadas de sistemas utilizadas: | |
| // write, pthread_create, pthread_join, pthread_exit, exit |
This file contains hidden or 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
| data State = Q1 | Q2 deriving Show | |
| data Sigma = Zer | One | Cee | Nan deriving Show | |
| data Gamma = R | B | G deriving Show | |
| delta _ _ [] = error "Finished!" | |
| delta Q1 Zer (R:p) = (Q1, B:R:p) | |
| delta Q1 Zer (B:p) = (Q1, B:B:p) | |
| delta Q1 Zer (G:p) = (Q1, B:G:p) |
This file contains hidden or 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
| {-# LANGUAGE TypeFamilies #-} | |
| import Control.Monad (mzero) | |
| class Pushdown m where | |
| data State m :: * | |
| data Sigma m :: * | |
| data Gamma m :: * | |
| startState :: State m |