Hunt 4: Logic bugs
此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
Bugs with no error
- The hardest bugs give no message. The program runs, but the answer is wrong.
- Test with the expected output: what should come out? What comes out?
- Check the first value and the last value of every loop.
| Word | Meaning |
|---|---|
| logic bug | the code runs, but does the wrong thing |
| off by one | a loop that runs one time too many or too few |
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Your pet is stuck! This program should output 1 / 2 / 3 / 4 / 5. Find the bug and fix it.
点击“运行”查看此处输出。
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Your pet is stuck! This program should output 3 / 2 / 1 / Go!. Find the bug and fix it.
点击“运行”查看此处输出。
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Your pet is stuck! This program should output Ana. Find the bug and fix it.
点击“运行”查看此处输出。
难度 3/5 · 今日首次完成可获 200 金币及少量额外奖励
Your pet is stuck! This program should output Result: 10. Find the bug and fix it.
点击“运行”查看此处输出。
难度 3/5 · 今日首次完成可获 200 金币及少量额外奖励
Your pet is stuck! This program should output -2. Find the bug and fix it.
点击“运行”查看此处输出。