diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-07-11 16:16:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-11 16:16:31 +0100 |
| commit | c64e679033a4e92ab286486db649f5a488b654d3 (patch) | |
| tree | 66fa11c12f38796d5a17f3eeeb8e70cb5feff194 /challenge-120 | |
| parent | b81550fa801922dd74fe0cd50d10d965e3334fd6 (diff) | |
| parent | 5a27d185b806b92ad3dfa1a9a193b42ccfa9890e (diff) | |
| download | perlweeklychallenge-club-c64e679033a4e92ab286486db649f5a488b654d3.tar.gz perlweeklychallenge-club-c64e679033a4e92ab286486db649f5a488b654d3.tar.bz2 perlweeklychallenge-club-c64e679033a4e92ab286486db649f5a488b654d3.zip | |
Merge pull request #4483 from luc65r/120
Challenge 120 in Odin
Diffstat (limited to 'challenge-120')
| -rw-r--r-- | challenge-120/luc65r/odin/ch-1.odin | 10 | ||||
| -rw-r--r-- | challenge-120/luc65r/odin/ch-2.odin | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/challenge-120/luc65r/odin/ch-1.odin b/challenge-120/luc65r/odin/ch-1.odin new file mode 100644 index 0000000000..23497f4c3f --- /dev/null +++ b/challenge-120/luc65r/odin/ch-1.odin @@ -0,0 +1,10 @@ +package main + +import "core:fmt" +import "core:os" +import "core:strconv" + +main :: proc() { + n, _ := strconv.parse_uint(os.args[1], 10); + fmt.println(n & 0x55 << 1 | n & 0xAA >> 1); +} diff --git a/challenge-120/luc65r/odin/ch-2.odin b/challenge-120/luc65r/odin/ch-2.odin new file mode 100644 index 0000000000..5dda5d07ae --- /dev/null +++ b/challenge-120/luc65r/odin/ch-2.odin @@ -0,0 +1,12 @@ +package main + +import "core:fmt" +import "core:os" +import "core:strconv" + +main :: proc() { + h, _ := strconv.parse_uint(os.args[1][:2], 10); + m, _ := strconv.parse_uint(os.args[1][3:5], 10); + d := abs(f64(h % 12) - f64(m) * 11 / 60); + fmt.printf("%.0f°\n", min(d, 12 - d) * 30); +} |
