Skip to content

Commit

Permalink
converting-to-rst (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepSpace2 authored Oct 4, 2020
1 parent 692dc70 commit 13212d9
Show file tree
Hide file tree
Showing 81 changed files with 1,083 additions and 719 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/templates
.vscode
.idea
*.rst.src
prepare-codeblocks.py
prepare-toctree.py
38 changes: 22 additions & 16 deletions Exercism.io/Binary/README.md → Exercism.io/Binary/README.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# Exercism.io\Binary
Exercism.io\\Binary
===================

## Description
Description
-----------

Convert a binary number, represented as a string (e.g. `'101010'`), to its decimal equivalent using first principles.

Implement binary to decimal conversion. Given a binary input string, your program should produce a decimal output. The program should handle invalid inputs.

## Input
Input
-----

A string representing a binary number.

## Output
Output
------

An integer in base-10.

## Sample Input/Output

|Input|Output|
|:-:|:-:|
|0|0|
|1|1|
|10|2|
|11|3|
|11010|26|
|000011111|31|
|2|ArgumentError|
|01201|ArgumentError|
Sample Input/Output
-------------------

.. csv-table::
:header: "Input", "Output"

"0", "0"
"1", "1"
"10", "2"
"11", "3"
"11010", "26"
"000011111", "31"
"2", "ArgumentError"
"01201", "ArgumentError"
18 changes: 0 additions & 18 deletions Exercism.io/Binary/Solutions.md

This file was deleted.

20 changes: 20 additions & 0 deletions Exercism.io/Binary/Solutions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Solutions
=========

Crystal
-------

.. code-block:: crystal
module Binary
extend self
def to_decimal(binary : String) : Int
raise Exception.new if binary.chars.any? { |e| !['0', '1'].includes?(e) }
dec = 0
binary.chars.reverse.each_with_index do |digit, index|
dec += digit.to_i * (2 ** index) if digit == '1'
end
dec
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Exercism.io\Rna Transcription
Exercism.io\\Rna Transcription
==============================

## Description
Description
-----------

Given a DNA strand, return its RNA complement (per RNA transcription).

Expand All @@ -20,20 +22,24 @@ Given a DNA strand, its transcribed RNA strand is formed by replacing each nucle

`A` -> `U`

## Input
Input
-----

A string representing DNA.

## Output
Output
------

A string representing RNA.

## Sample Input/Output
Sample Input/Output
-------------------

|Input|Output|
|:-:|:-:|
|'C'|'G'|
|'G'|'C'|
|'T'|'A'|
|'A'|'U'|
|'ACGTGGTCTTAA'|'UGCACCAGAAUU'|
.. csv-table::
:header: Input, Output

'C', 'G'
'G', 'C'
'T', 'A'
'A', 'U'
'ACGTGGTCTTAA', 'UGCACCAGAAUU'
14 changes: 0 additions & 14 deletions Exercism.io/Rna Transcription/Solutions.md

This file was deleted.

16 changes: 16 additions & 0 deletions Exercism.io/Rna Transcription/Solutions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Solutions
=========

Crystal
-------

.. code-block:: crystal
module RnaComplement
def self.of_dna(dna : String)
dna.gsub({'G' => 'C',
'C' => 'G',
'T' => 'A',
'A' => 'U'})
end
end
19 changes: 0 additions & 19 deletions Kattis/A Different Problem/README.md

This file was deleted.

43 changes: 43 additions & 0 deletions Kattis/A Different Problem/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Kattis\\A Different Problem
===========================

Description
-----------

Write a program that computes the difference between non-negative integers.

Input
-----

Each line of the input consists of a pair of integers. Each integer is between `0` and `10`:superscript:`15` (inclusive). The input is terminated by end of file.

Output
------

For each pair of integers in the input, output one line, containing the absolute value of their difference.

Sample Input/Output
-------------------

.. csv-table::
:header: "Input", "Output"

"| 10 12
| 71293781758123 72784
| 1 12345677654321", "| 2
| 71293781685339
| 12345677654320"













13 changes: 0 additions & 13 deletions Kattis/A Different Problem/Solutions.md

This file was deleted.

15 changes: 15 additions & 0 deletions Kattis/A Different Problem/Solutions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Solutions
=========

Python 3
--------

.. code-block:: python
while True:
try:
line = input()
except EOFError:
break
a, b = map(int, line.split())
print(abs(a - b))
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
# Kattis\A Real Challenge
Kattis\\A Real Challenge
========================

## Description
Description
-----------

Old MacDonald had a farm, and on that farm she had a square-shaped pasture, and on that pasture she had a cow that was prone to escape. So now Old MacDonald wants to set up a fence around the pasture. Given the area of the pasture, how long a fence does Old MacDonald need to buy?

## Input
Input
-----

The input consists of a single integer `a` (`1 ≤ a ≤ 10`<sup>`18`</sup>), the area in square meters of Old MacDonald’s pasture.
The input consists of a single integer `a` (`1 ≤ a ≤ 10`:superscript:`18`), the area in square meters of Old MacDonald’s pasture.

## Output
Output
------

Output the total length of fence needed for the pasture, in meters. The length should be accurate to an absolute or relative error of at most `10`<sup>`−6`</sup>.
Output the total length of fence needed for the pasture, in meters. The length should be accurate to an absolute or relative error of at most `10`:superscript:`−6`.

## Sample Input/Output
Sample Input/Output
-------------------

|Input|Output|
|:----:|:-----:|
|16|16|
|5|8.94427190999915878564|
.. csv-table::
:header: Input, Output

16, 16
5, 8.94427190999915878564
11 changes: 0 additions & 11 deletions Kattis/A Real Challenge/Solutions.md

This file was deleted.

13 changes: 13 additions & 0 deletions Kattis/A Real Challenge/Solutions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Solutions
=========

Python 3
--------

.. code-block:: python
from math import sqrt
print(4 * sqrt(int(input().strip())))
Since the input is the area of the square we take the square root of the input and multiply by 4 which gives us the perimeter of the square.
26 changes: 17 additions & 9 deletions Kattis/ABC/README.md → Kattis/ABC/README.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
# Kattis\ABC
Kattis\\ABC
===========

## Description
Description
-----------

You will be given three integers `A`, `B` and `C`. The numbers will not be given in that exact order, but we do know that `A` is less than `B` and `B` less than `C`. In order to make for a more pleasant viewing, we want to rearrange them in a given order.

## Input
Input
-----

The first line contains the three positive integers `A`, `B` and `C`, not necessarily in that order. The three numbers will be less than or equal to `100`.

The second line contains three uppercase letters `A`, `B` and `C` (with no spaces between them) representing the desired order.

## Output
Output
------

Output `A`, `B` and `C` in the desired order on a single line, separated by single spaces.

## Sample Input/Output
Sample Input/Output
-------------------

| Input | Output |
|:---------------:|:--------:|
| `1 5 3`<br>`ABC`| `1 3 5`|
| `6 4 2`<br>`CAB`| `6 2 4`|
.. csv-table::
:header: Input, Output

"| 1 5 3
| ABC", 1 3 5
"| 6 4 2
| CAB", 6 2 4
Loading

0 comments on commit 13212d9

Please sign in to comment.