code golf

您所在的位置:网站首页 太原到美国有直飞的航班吗 code golf

code golf

2024-07-14 18:24:11| 来源: 网络整理| 查看: 265

Back-story

After typing up your essay on your new Macbook, you look up at the screen and realize that you typed in ten pages of gibberish! Or is it? On further inspection, you come to find that your Option key was stuck this whole time and these special Option-key characters correspond to the ASCII keys on your keyboard!

Challenge

Your challenge is to write the shortest possible program or function that converts an encoded Option-key input into ASCII output.

Here's the Option-key special characters to ASCII characters dictionary:

+---------+-------+-------+-------+ | OPT-KEY | CODE | ASCII | CODE | +---------+-------+-------+-------+ | ¡ | 161 | 1 | 49 | | ™ | 8482 | 2 | 50 | | £ | 163 | 3 | 51 | | ¢ | 162 | 4 | 52 | | ∞ | 8734 | 5 | 53 | | § | 167 | 6 | 54 | | ¶ | 182 | 7 | 55 | | • | 8226 | 8 | 56 | | ª | 170 | 9 | 57 | | º | 186 | 0 | 48 | | – | 8211 | - | 45 | | ≠ | 8800 | = | 61 | | œ | 339 | q | 113 | | ∑ | 8721 | w | 119 | | ® | 174 | r | 114 | | † | 8224 | t | 116 | | ¥ | 165 | y | 121 | | ø | 248 | o | 111 | | π | 960 | p | 112 | | “ | 8220 | [ | 91 | | ‘ | 8216 | ] | 93 | | « | 171 | \ | 92 | | å | 229 | a | 97 | | ß | 223 | s | 115 | | ∂ | 8706 | d | 100 | | ƒ | 402 | f | 102 | | © | 169 | g | 103 | | ˙ | 729 | h | 104 | | ∆ | 8710 | j | 106 | | ˚ | 730 | k | 107 | | ¬ | 172 | l | 108 | | … | 8230 | ; | 59 | | æ | 230 | ' | 39 | | Ω | 937 | z | 122 | | ≈ | 8776 | x | 120 | | ç | 231 | c | 99 | | √ | 8730 | v | 118 | | ∫ | 8747 | b | 98 | | µ | 181 | m | 109 | | ≤ | 8804 | , | 44 | | ≥ | 8805 | . | 46 | | ÷ | 247 | / | 47 | |   | 160 | | 32 | | ⁄ | 8260 | ! | 33 | | € | 8364 | @ | 64 | | ‹ | 8249 | # | 35 | | › | 8250 | $ | 36 | | fi | 64257 | % | 37 | | fl | 64258 | ^ | 94 | | ‡ | 8225 | & | 38 | | ° | 176 | * | 42 | | · | 183 | ( | 40 | | ‚ | 8218 | ) | 41 | | — | 8212 | _ | 95 | | ± | 177 | + | 43 | | Œ | 338 | Q | 81 | | „ | 8222 | W | 87 | | ‰ | 8240 | R | 82 | | ˇ | 711 | T | 84 | | Á | 193 | Y | 89 | | Ø | 216 | O | 79 | | ∏ | 8719 | P | 80 | | ” | 8221 | { | 123 | | ’ | 8217 | } | 125 | | » | 187 | | | 124 | | Å | 197 | A | 65 | | Í | 205 | S | 83 | | Î | 206 | D | 68 | | Ï | 207 | F | 70 | | ˝ | 733 | G | 71 | | Ó | 211 | H | 72 | | Ô | 212 | J | 74 | |  | 63743 | K | 75 | | Ò | 210 | L | 76 | | Ú | 218 | : | 58 | | Æ | 198 | " | 34 | | ¸ | 184 | Z | 90 | | ˛ | 731 | X | 88 | | Ç | 199 | C | 67 | | ◊ | 9674 | V | 86 | | ı | 305 | B | 66 | |  | 194 | M | 77 | | ¯ | 175 | < | 60 | | ˘ | 728 | > | 62 | | ¿ | 191 | ? | 63 | +---------+-------+-------+-------+

It's not that simple though... There are a five Option-key special characters that do not follow this trend, specifically (Option-key special characters and their corresponding lowercase ASCII characters):

Beginning of input or after special space (" ", code 160): +---------+-------+-------+-------+ | OPT-KEY | CODE | ASCII | CODE | +---------+-------+-------+-------+ | ` | 96 | ~ | 126 | | ´ | 180 | E | 69 | | ¨ | 168 | U | 85 | | ˆ | 710 | I | 73 | | ˜ | 732 | N | 78 | +---------+-------+-------+-------+ Otherwise: +---------+-------+-------+-------+ | OPT-KEY | CODE | ASCII | CODE | +---------+-------+-------+-------+ | ` | 96 | ` | 96 | | ´ | 180 | e | 101 | | ¨ | 168 | u | 117 | | ˆ | 710 | i | 105 | | ˜ | 732 | n | 110 | +---------+-------+-------+-------+

When any of these characters are found after the Option-key special space character ( ) or at the beginning of the input, output the capitalized version of their ASCII equivalents. (Note that the capitalized version of "`" is "~".) Otherwise, output the lowercase version of their ASCII equivalents.

Finally, do not attempt to decode any other characters, just output them.

Rules & Grading All Code-Golf rules barring standard loopholes apply. Scores will be based on the number of bytes your program uses. The program with the smallest score (or the smallest number of bytes) will win! Examples

Input, output:

`´¨ˆ˜` ~euin` ´´ ´⁄ Ee E! `` ´ ¨ ˆ ˜ ~` E U I N Ó´¬¬ø ∑ø®¬∂⁄ Hello world! „˙冠ˆß ¥ø¨® ˜åµ´¿ Í´®©´å˜† ıˆ¬¬ˆå®∂ß⁄ What Is your Name? Sergeant Billiards! „˙´®´ ∂ø ¥ø¨ çøµ´ ƒ®øµ¿ Where do you come from? „˙´˜ ˆ µø√´∂ †ø Áø®˚ß˙ˆ®´≤ †˙´®´ ∑åߠ堵嘠∑分ˆ˜© ƒø® µ´≥ When I moved to Yorkshire, there was a man waiting for me. ӈߠ˜åµ´ ∑åß ∏嬴߆ˆ˜´≥ Ó´ çåµ´ ƒ®øµ Òå˜∂ø≥ His Name was Palestine. He came from Lando. Åç®øßß †˙´ ®´´ƒ ¬å¥ ˜ø†˙ˆ˜©≥ Across the reef lay Nothing. Â¥ ˜åµ´ ˆß ´å†ø˜≥ My Name Is Eaton. ˆ˜† µåˆ˜·√øˆ∂‚ ” ß†∂ÚÚçø¨† ¯¯ ÆÓ´¬¬ø ∑ø®¬∂⁄Æ… ’ Int main(void) { std::cout


【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭