Stock-order processing
עיבוד הזמנות מלאי
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.
לחץ על הרץ כדי לראות את התוצא כאן.