Stock-order processing
此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
库存订单处理
IGCSE 0478 · 算法编写
阅读下面的题目,在打开提示之前先自己作答。按题目规定的输入和输出格式编写。检查会运行几个互相独立的用例,只对一个样例输出是不够的。
难度 5/5 · 今日首次完成可获 400 金币及少量额外奖励
Stock is 9. Requests are 4, 0, 6, 5. A positive request is accepted only if it fits. Give Stock after each request.
难度 5/5 · 今日首次完成可获 400 金币及少量额外奖励
With Stock = 5, valid request quantities are 1 to 5. Give four boundary test quantities in ascending order, including just-outside values.
难度 5/5 · 今日首次完成可获 400 金币及少量额外奖励
Read initial Stock (non-negative), NumberOfRequests (1 to 6), then NumberOfRequests requested quantities. A request must be positive and no greater than current Stock. For each request output accepted and subtract it, or rejected and leave Stock unchanged. Finally output Stock.
点击“运行”查看此处输出。