谚语

谚语

中等

说明

俗话说,只因少了一枚马蹄钉,一个王国便就此覆灭。

给定一组输入,生成相应的谚语。 例如,给定列表["nail", "shoe", "horse", "rider", "message", "battle", "kingdom"],你需要输出这首谚语诗谣的完整内容:

For want of a nail the shoe was lost.
For want of a shoe the horse was lost.
For want of a horse the rider was lost.
For want of a rider the message was lost.
For want of a message the battle was lost.
For want of a battle the kingdom was lost.
And all for the want of a nail.

注意,输入的列表可能各不相同;你的解答应能处理任意长度和任意内容的列表。 输出文本的每一行都不应是固定不变的字符串,而应随给定的输入而变化。

输入格式

每个输入列表都以一个以 null 结尾的字符串表示,每个输入的末尾都有一个换行符。

例如"nail\nshoe\nhorse\nrider\nmessage\nbattle\nkingdom\n"

寄存器

寄存器 用途 类型 说明
$a0 输入 地址 以 null 结尾的输入字符串,每个输入后跟一个换行符
$a1 输入/输出 地址 以 null 结尾的输出字符串
$t0-9 临时 任意 用于临时存储

来源

Wikipedia链接会在新窗口或新标签页中打开
通过 GitHub 编辑 链接将在新窗口或新标签页中打开
MIPS Assembly Exercism

准备好开始 谚语 了吗?

注册 Exercism,借助 70 个练习 和真人导师指导,学习并掌握 MIPS Assembly,全部免费。