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
(loop [test-case-remaining (Integer/parseInt (read-line))] | |
(while (not= 0 test-case-remaining) | |
(do (println (let [factorial (fn [n] | |
(reduce * (take n (range 1 (inc n))))) | |
to-the-power (fn [n m] | |
(reduce * (repeat m n))) | |
e-to-the-power-x (fn [x] | |
(inc (apply + (map #(float (/ (to-the-power x %) | |
(factorial %))) | |
(range 1 10)))))] |
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
(defn bigboy [x] | |
(reduce + (distinct (concat (take-nth 3 (range x)) (take-nth 5 (range x)))))) | |
(loop [start 1 end (Integer/parseInt (read-line))] | |
(when (<= start end) | |
(println (bigboy (Integer/parseInt (read-line)))) | |
(recur (inc start) end))) |
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
(use 'pl.danieljanus.tagsoup) | |
(use 'hiccup.core) | |
(defn parser [file_path] | |
(pl.danieljanus.tagsoup/parse (java.io.ByteArrayInputStream. (.getBytes (slurp file_path))))) | |
(defn attr_filter [element] | |
(cond | |
(map? element) {} | |
(= (type []) (type element)) (mapv identity (map attr_filter element)) |
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
(use 'pl.danieljanus.tagsoup) | |
(use 'hiccup.core) | |
(defn parser [input] | |
(pl.danieljanus.tagsoup/parse | |
(java.io.ByteArrayInputStream. | |
(.getBytes | |
(slurp input))))) | |
(defn dissoc-all [dmap keys] |
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
(defn move | |
([dvec direction indx] | |
(cond (= direction :up) (move dvec :swap indx (dec indx)) | |
(= direction :down) (move dvec :swap indx (inc indx)) | |
:else (println "Wrong Number of args"))) | |
([dvec direction indx1 indx2] | |
(if (= direction :swap) | |
(assoc dvec indx2 (nth dvec indx1) indx1 (nth dvec indx2)) | |
(println "Invalid arguments")))) |
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
def LinearSearch(item, array): | |
return True if item in array else False |
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
import math | |
def get_num(): | |
inp = input("Enter a number: ") | |
try: | |
return float(inp) | |
except: | |
print("Enter a valid number.") | |
get_num() |
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
#include <stdio.h> | |
int main() | |
{ | |
int r, c; | |
float n, s; | |
do{ | |
c=0; | |
s=0.0; | |
while(c<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
def get_input(): | |
inp = float(input()) | |
if inp > 10 or inp < 0: | |
print("nota invalida") | |
return get_input() | |
else: | |
return inp | |
def calculate(): | |
a = get_input() |
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
from itertools import combinations | |
def ifTri (a, b, c): | |
if a + b > c and b + c > a and c + a > b: | |
return True | |
else: | |
return False | |
inp = input().split(" ") | |
pool = [] |
OlderNewer