Skip to content

Commit

Permalink
Add problematic code
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Oct 22, 2024
1 parent f628688 commit e567db7
Show file tree
Hide file tree
Showing 6 changed files with 11,925 additions and 37 deletions.
31 changes: 31 additions & 0 deletions solutions/beecrowd/1024/1024.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(ns main)

(defn in? [start end val]
(and (>= val start) (<= val end)))

(defn letter? [char]
(or (in? 65 90 (int char))
(in? 97 122 (int char))))

(defn encrypt [string]
(loop [index (dec (count string))]
(let [current-char (.charAt string index)
encrypted-char (if (letter? current-char)
(char (+ (int current-char) 3))
current-char)
encrypted-char (if (< index (/ (count string) 2))
(char (- (int encrypted-char) 1))
encrypted-char)]
(printf "%c" encrypted-char))
(if (> index 0)
(recur (dec index))
(printf "%n"))))

(defn main []
(loop [n (Integer/parseInt (read-line))]
(let [line (read-line)]
(encrypt line))
(when (> n 1)
(recur (dec n)))))

(main)
Empty file added solutions/beecrowd/1024/WRONG
Empty file.
18 changes: 18 additions & 0 deletions solutions/beecrowd/1024/generate_in.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -euo pipefail

TESTCASES=4062
MAX_CHARS_PER_LINE=1000

function chr {
printf \\$(printf '%03o' $1)
}

echo "${TESTCASES}"
for _ in $(seq "${TESTCASES}"); do
for _ in $(seq $((RANDOM % MAX_CHARS_PER_LINE + 1))); do
chr "$((RANDOM % 94 + 33))"
done
echo
done
Loading

0 comments on commit e567db7

Please sign in to comment.