본문 바로가기

Read a scenario and plan an algorithm

시나리오에서 계약으로

예약 시스템은 요청된 그룹 크기를 읽습니다. 전체 그룹을 수락하거나 거절해야 하며, 거절할 때는 사용 가능한 좌석 수가 변경되지 않아야 합니다.

식별자 유형 목적
Remaining (남은 좌석) INTEGER 사용 가능한 좌석
Size (크기) INTEGER 요청한 좌석
Accepted (수락 여부) BOOLEAN 요청이 수용 가능한지 여부

입력, 결정, 상태 변화, 출력을 분리하십시오. 포괄적 경계를 명시하십시오: 남은 좌석을 모두 사용하는 그룹도 수용 가능합니다.

Explain your choice of data structure and loop. Identify one boundary case and predict its result. For a subroutine, explain what is returned or changed in the caller.

이 브라우저의 이번 세션에 저장되었습니다. 교사나 본인이 직접 검토하십시오; 이 설명은 자동으로 채점되지 않습니다.

해당 설명을 다음 기준에 따라 검토하십시오.
  • My types and data structure match the data and the question.
  • I justified the loop and checked its first and last iterations.
  • Initial values and rejected operations preserve the intended state.
  • My test includes input, purpose and expected result.
  • I distinguished returning a value from printing and changing caller state.

로그인 또는 계정 만들기

IGCSE, A-Level & AP