Skip to content

Commit

Permalink
Replace NQueens.cpp with NQueens.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
OmeletWithoutEgg committed Apr 6, 2024
1 parent cd00a20 commit faef98e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions codes/Misc/NQueens.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def solve(n)
if n % 6 == 2 then
(2..n).step(2) + [3,1] + (7..n).step(2) + [5]
elsif n % 6 == 3 then
(4..n).step(2) + [2] + (5..n).step(2) + [1,3]
else
(2..n).step(2) + (1..n).step(2)
end
end
2 changes: 1 addition & 1 deletion pdf/content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
path: Josephus.cpp
verified: 8137f19
- name: N Queens Problem
path: NQueens.cpp
path: NQueens.rb
verified:
# - name: Tree Knapsack
# path: TreeKnapsack.cpp
Expand Down
5 changes: 5 additions & 0 deletions pdf/gen_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ def gen_tex(sections: List[Dict[str, Any]], out: IO) -> None:
"\\IncludeTex{%s}{%s}\n"
% (escape_latex(content["name"]), content["path"])
)
elif ext == ".rb":
out.write(
"\\IncludeCode[language=ruby]{%s}{%s}\n"
% (escape_latex(content["name"]), content["path"])
)
elif base == "vimrc":
out.write(
"\\IncludeCode[language=vim]{%s}{%s}\n"
Expand Down

0 comments on commit faef98e

Please sign in to comment.