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
Constrangeri: | |
* timp de executie: 1 sec | |
Explicatie: | |
Rezolvam problema prin metoda programarii dinamice. Odata impartit fisierul in cuvinte, | |
pentru fiecare grup de cuvinte consecutive calculam penalitatea p asociata unei linii | |
care le contine. | |
* l[i] = lungimea cuvantului i | |
* p[i][j] = t[i][j] * t[i][j], daca t[i][j] >= 0 |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
namespace Parser | |
{ | |
enum TokenType | |
{ |
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
#ifndef _NDEBUG | |
#define _CRTDBG_MAP_ALLOC | |
#include <stdlib.h> | |
#include <crtdbg.h> | |
#endif | |
#include <algorithm> | |
#include <chrono> | |
#include <fstream> | |
#include <functional> |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.IO; | |
using System.Threading; | |
using System.Drawing; | |
namespace ImageChecker | |
{ |
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
rem ghc -O2 -auto-all -prof --make slowsilver && slowsilver +RTS -p -hc && hp2ps slowsilver | |
ghc -O2 -auto-all -prof --make slowsilver && slowsilver +RTS -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
using System; | |
using System.Diagnostics; | |
using System.Threading.Tasks; | |
namespace ThreadRingTask | |
{ | |
class Agent | |
{ | |
public Agent Next; |
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 Control.Monad | |
import Data.Char | |
import Data.List | |
import System.Environment | |
import Control.Monad.Instances | |
main = getArgs >>= mapM (liftM lines . readFile) >>= return . liftM2 zip head (head . tail) |
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
module Main (main) where | |
import Control.Parallel.Strategies | |
import Control.Monad | |
import Data.Char | |
solve s (x : xs) = (solve x xs >>= \r -> [s + r, s - r]) ++ solve (10 * s + x) xs | |
solve s _ = [s] | |
ugly x = x `mod` 2 == 0 || x `mod` 3 == 0 || x `mod` 5 == 0 || x `mod` 7 == 0 |
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
module Main where | |
import Control.Monad | |
import Data.Char | |
import Data.List | |
import Data.Ord | |
process = reverse . (sortBy $ comparing snd) . (map $ \x -> (head x, length x)) . group . sort . words . map toLower . filter (flip notElem "().,\"") | |
main = getContents >>= print . process |
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
module Main where | |
import Data.Ix | |
data Cell = Cell | |
{ | |
position :: (Integer, Integer, Integer), | |
value :: String | |
} |