[2021铁人赛 Day20] General Skills 17

  • 今天我们稍微调动一下顺序,先解 General Skills 系列的最後一题,
    因为跟昨天的题目算是同一题的延伸。这两题我觉得相对没出那麽好啦,
    不过也算是学点新东西~

  • General Skills / 1_wanna_b3_a_r0ck5tar
    https://ithelp.ithome.com.tw/upload/images/20211005/20111429Cc2PpKb03r.png
    这题跟昨天的题目 80% 是一样的,我们一样先下载题目给的档案:

    Rocknroll is right              
    Silence is wrong                
    A guitar is a six-string        
    Tommy's been down               
    Music is a billboard-burning razzmatazz!
    Listen to the music             
    If the music is a guitar                  
    Say "Keep on rocking!"                
    Listen to the rhythm
    If the rhythm without Music is nothing
    Tommy is rockin guitar
    Shout Tommy!                    
    Music is amazing sensation 
    Jamming is awesome presence
    Scream Music!                   
    Scream Jamming!                 
    Tommy is playing rock           
    Scream Tommy!       
    They are dazzled audiences                  
    Shout it!
    Rock is electric heaven                     
    Scream it!
    Tommy is jukebox god            
    Say it!                                     
    Break it down
    Shout "Bring on the rock!"
    Else Whisper "That ain't it, Chief"                 
    Break it down 
    

    同样是奇怪的歌词,因为有昨天的经验,可以猜到一样要用那个网站进行翻译:
    https://ithelp.ithome.com.tw/upload/images/20211005/20111429AbRDLJDx1H.png
    不一样的是,这次却没有任何输出?
    我们观察到下方有个 input 栏位,想必是要填入一些输入资料吧!

    虽然这样说,但感觉没有任何头绪...
    我们先在这个网站上找找教学文件、范例等等,
    结果的确有一点蛛丝马迹,以下是一些有助於解题的资讯,
    都可以在这个网站上找到:

    • xxx is yyy
      xxx 是变数,yyy 是值,代表把 yyy 的值放进 xxx 这个变数
    • the xxx 以及 xxx 算不同的变数
    • if xxx is yyy
      如果 xxx 等於 yyy 的值
    • nothing, nowhere, nobody, empty 以及 gone 代表 null 或 0
    • Say, Shout, Whisper 以及 Scream 代表 print 到 stdout ,也就是印出值
    • Listen to 代表 input 资料。
    • 最重要的一点
      这个语言的每个字除了关键字字串变数以外都是数字
      • 先讲字串,用 "" 括起来的就是字串,使用 Say 等关键字会将字串原封不动印出
      • 关键字就是上面提到的那些有功能的单字
      • 变数就是 xxx is yyy 这种, is 前面的就是变数。
      • 数字怎麽表示呢?
        答案是看字数,该单字几个字代表什麽数字,两个数字连一起的话是代表两个位数,举例:
        apple pie banana 代表: 5325 (五千三百二十五)
        apple is great great good good eat 代表: apple 这个变数放入 55443 这个值
        
        其他符号则是有些规则, - 在单字中算一个字,
        . 在单字中央的话是小数点,在字尾则忽略,
        其他所有符号则都会被忽略。举例:
        cat eat apple-pie 代表: 339
        dsd*fjj.!ef$?. 代表: 6.2
        
        值得一提的是,避免 1 、 2 等数字能表示的字太少,
        字数计算每多十个字扣掉十,也就是 字数 = 字数 mod 10 的意思,举例:
        beautiful-banana great! 代表: 65
        

    OK ,差不多了,我们来解析歌词,
    首先看看需要处理输入的部份:

    A guitar is a six-string        
    Tommy's been down 
    Music is a billboard-burning razzmatazz!
    Listen to the music             
    If the music is a guitar                  
    Say "Keep on rocking!" 
    

    可以解析成:

    1. A guitar 装入 10 (a: 1 与 six-string: 10)
    2. 这里不会用到,跳过
    3. Music 装入 170 (a: 1 与 billboard-burning: 7 与 razzmatazz!: 10)
    4. 把输入装到 the music (注意 the music 与 Music 不同)
    5. 如果 the music 是 a guitar (10) 就
    6. 输出 "Keep on rocking!" 字串
      应该是要我们输入 10 ,这样才能让 the music 等於 a guitar 。
      所以 input 栏位我们先输入 10 ,然後换行,因为输入资料以一行为单位。

    还有一段输入部份:

    Listen to the rhythm
    If the rhythm without Music is nothing
    

    解析成:

    1. 把输入装到 the rhythm
    2. 如果 the rhythm 减 Music 等於 0 就
      without 代表减法,也是一个关键字,而 Music 上面有定义,存有 170 ,
      所以我们目标是让输入减去 170 会得到 0 ,只要让输入是 170 即可!
      那刚刚 10 的下一行我们就打入 170 ,因此输入栏位会像这样:
    10
    170
    

    按下 Rock! 吧~
    输出就成功出现了:

    Keep on rocking!
    66
    79
    78
    74
    79
    86
    73
    Program completed in 118 ms
    

    跟昨天是一样的,我们将 ASCII code 转换过来吧,沿用一样的程序,得到:

    $ python ascii.py < code.txt 
    BONJOVI
    

    可见 BONJOVI 就是 flag 关键字了 (邦乔飞的英文)
    套上 flag 格式:

    picoCTF{BONJOVI}
    

<<:  [day 20 ] SwiftUI Essentials-Creating and Combining Views

>>:  Day20 - RB tree

找LeetCode上简单的题目来撑过30天啦(DAY8)

题号;100 标题:Same Tree 难度;Easy Given the roots of two...

[Day05] Github page

Github page 的特色 劈头就上官方文件和 Landing page。 Github pag...

Day 06 Heroku、Heroku CLI、Git push建置

创建Heroku APP https://www.heroku.com/ 进入网站注册并登入Hero...

【HTML】【CSS】如何处理inline-block 元素之间的空白

【前言】 本系列为个人前端学习之路的学习笔记,在过往的学习过程中累积了很多笔记,如今想藉着IT邦帮忙...

Day5 Python 基础教学 (四)

了解完型别之後,接下来就是该知道一些基础的语法了, 循环语法 range() 方法 在开始介绍Pyt...