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
Napište program, který dostane na prvním řádku standardního vstupu výraz zapsaný v preorder notaci, výraz vyhodnotí a výsledek vypíše na standardní výstup. Ve výrazu se mohou vyskytovat celá kladná čísla, která se vejdou do 32-bit. integeru se znaménkem (tj. menší než 231 = 2147483648), binární operátory +, -, * a / a operátor unárního minus ~. Operátory i čísla jsou odděleny mezerami. Výsledek vypište jako celé číslo se znaménkem v dekadickém formátu. | |
Při vyhodnocování výrazu používejte výhradně celočíselnou aritmetiku. Všechny mezivýsledky se vejdou do 32-bit. integeru se znaménkem. Pokud by v průběhu výpočtu došlo k přetečení (mezivýsledek se nevejde do intu se znaménkem), vypište jako výsledek řetězec "Overflow Error". Pokud dojde k dělení nulou vypište chybový řetězec "Divide Error". A konečně pokud zjistíte, že zápis výrazu je z jakéhokoli důvodu neplatný (objevují se v něm neznámé tokeny, nedodržuje preorder formát apod.), vypište chybovou hlášku "Format Error". | |
Vyhodnocované výrazy jsou relativně kr |
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
static private bool IsValidFormula(string formula) { | |
// Ja bych byl pouzil Regexpy a mel to na tri radky, jenze to neprojde na cas, takze automat :/// | |
ValidatorState state = ValidatorState.START; | |
if (formula[0] != '=') | |
{ | |
return false; | |
} | |
for (int i = 1; i < formula.Length; i++) | |
{ |
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
test |
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 CodEx; | |
public struct Path | |
{ | |
public int Steps; // Počet kroku pro dosazeni | |
public int I; // Pozice I pri dosazeni pismene | |
public int J; // Pozice J pri dosazeni pismene | |
} |
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
for f in $@ | |
do | |
cat $f >> tempprezencka | |
done | |
cat tempprezencka | sort | uniq -c | sort -r > tempprezencka2 | |
cat tempprezencka2 | |
rm tempprezencka tempprezencka2 |
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
# nactu prezencky | |
for f in $@ | |
do | |
cat $f >> tempprezencka | |
done | |
# zjistim unikatni jmena | |
cat tempprezencka | sort | uniq > tempprezencka2 | |
rm tempprezencka |
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
# nactu si soubory s prezenci a ziskam unikatni seznam ucastniku | |
for f in $@ | |
do | |
cat $f >> tempprezencka | |
done | |
cat tempprezencka | sort | uniq > tempprezencka2 | |
rm -f tempprezencka |
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
program lodky; | |
uses crt; | |
type HraciPole = array[0..11,0..11] of byte; | |
var pole: HraciPole; | |
polesuper: HraciPole; | |
i,j,y,rota: byte; | |
x: char; | |
input: string; |
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
<?php | |
$b = new Brainfuck(file_get_contents('hello.b')); | |
$b->execute(); | |
class BrainFuck { | |
private $code; | |
private $cells = array(); | |
private $cell = 0; |
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
program MultipleCondition; | |
uses crt; | |
var A: Integer; | |
begin | |
A := 0; | |
repeat | |
begin |