مسیرها
/
MIPS Assembly
MIPS Assembly
/
تمرین‌ها
/
زنجیره‌ی غذایی
زنجیره‌ی غذایی

زنجیره‌ی غذایی

متوسط

دستورالعمل‌ها

متن ترانه‌ی آهنگ «I Know an Old Lady Who Swallowed a Fly» را تولید کنید.

می‌توانید متن ترانه را کپی و پیست کنید یا آن را از یک فایل بخوانید، اما اگر با نگاه الگوریتمی به آن بپردازید، این مسئله بسیار جذاب‌تر می‌شود.

این یک ترانه‌ی تجمعی با منشأ ناشناخته است.

این یکی از چندین گونه‌ی رایج است.

I know an old lady who swallowed a fly.
I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a spider.
It wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a bird.
How absurd to swallow a bird!
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a cat.
Imagine that, to swallow a cat!
She swallowed the cat to catch the bird.
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a dog.
What a hog, to swallow a dog!
She swallowed the dog to catch the cat.
She swallowed the cat to catch the bird.
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a goat.
Just opened her throat and swallowed a goat!
She swallowed the goat to catch the dog.
She swallowed the dog to catch the cat.
She swallowed the cat to catch the bird.
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a cow.
I don't know how she swallowed a cow!
She swallowed the cow to catch the goat.
She swallowed the goat to catch the dog.
She swallowed the dog to catch the cat.
She swallowed the cat to catch the bird.
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a horse.
She's dead, of course!

قالب خروجی

متن ترانه را به‌صورت یک رشته‌ی مختوم به null خروجی بدهید.

ثبات‌ها

ثبات کاربرد نوع توضیح
$a0 ورودی عدد صحیح بند شروع
$a1 ورودی عدد صحیح بند پایان
$a2 ورودی/خروجی نشانی رشته‌ی خروجی مختوم به null
$t0-9 موقت هر نوع برای ذخیره‌سازی موقت

منبع

Wikipediaاین لینک در پنجره یا تب جدیدی باز می‌شود.
ویرایش از طریق GitHub این لینک در پنجره یا زبانه‌ی جدیدی باز می‌شود
MIPS Assembly Exercism

آماده‌اید زنجیره‌ی غذایی را شروع کنید؟

در Exercism ثبت‌نام کنید تا MIPS Assembly را همراه با 70 تمرین و مربی‌گری انسانی واقعی یاد بگیرید و در آن استاد شوید، همه‌ی این‌ها رایگان.