An open API service indexing awesome lists of open source software.

https://github.com/poudel/protohacke-rs

[WIP] Solutions for https://protohackers.com
https://github.com/poudel/protohacke-rs

protohackers protohackers-solutions rust

Last synced: 3 months ago
JSON representation

[WIP] Solutions for https://protohackers.com

Awesome Lists containing this project

README

        

#+title: protohackers.com solutions
#+startup: overview

[WIP] Solutions for https://protohackers.com exercises

* [[https://protohackers.com/problem/0][00 Smoke Test]]

TCP server that echoes back

#+begin_src shell
cargo run 0
#+end_src

To test

#+begin_src shell
nc 127.0.0.1 8838
#+end_src

* [[https://protohackers.com/problem/1][01 Prime time]]

Industrial strength primality tester

#+begin_src shell
cargo run 1
#+end_src

To test

#+begin_src shell
nc 127.0.0.1 8838
#+end_src

* [[https://protohackers.com/problem/2][02 Means to an End]]

#+begin_src shell
cargo run 2
#+end_src

To test it quickly

#+begin_src shell
python src/means_client.py
#+end_src

then type the messages as:

#+begin_src shell
I,1,1|I,2,2|Q,1,2
#+end_src

where messages are delimited by pipe and each message is delimited by
comma. The script then sends an encoded message to the running server
and prints the result of `Q`.

* [[https://protohackers.com/problem/3][03 Budget Chat]]

#+begin_src shell
cargo run 3
#+end_src

Then connect with

#+begin_src shell
nc 127.0.0.1 8838
#+end_src

and again to chat!

* [[https://protohackers.com/problem/4][04 Unusual Database Program]]

Build and run as follows

#+begin_src shell
cargo run 4
#+end_src

Then connect with

#+begin_src shell
nc -u 127.0.0.1 8838
#+end_src

* [[https://protohackers.com/problem/5][05 Mob in the Middle]]

Run the unusual budget chat with

#+begin_src shell
cargo run 3
#+end_src

then run this

#+begin_src shell
cargo run 5
#+end_src

Then connect with

#+begin_src shell
nc -u 127.0.0.1 8839
#+end_src

* [[https://protohackers.com/problem/6][06 Speed Daemon]]

#+begin_src shell
cargo run 6
#+end_src

to test

#+begin_src shell
python src/speed_daemon/client.py c1 c2 d
#+end_src

* Notes

#+begin_src shell
rsync -avz --exclude-from '.gitignore' ./ remoteuser@remoteserver:/path/to/remote/directory
#+end_src