www.youtube.com Detailed Explanation of Question 2: “A Function to Count Coin Combinations” from Japan’s 2025 FE Examination Section B Public Sample Problems In this video, we thoroughly explain Question 2 from the 2025 Public Sample Problems of the Fundamental Information Technology Engineer Examination (FE), Section B. The task is to complete the function change, which takes an integer n greater than 10 and returns the number of possible combinations of 1-yen, 5-yen, and 10-yen coins that add up exactly to n yen. This problem condenses the essential basics of algorithms and programming, which frequently appear in Section B. Based on the official explanation materials, we walk through the program step by step to help you clearly understand the logic flow and the importance of boundary conditions. Understanding the Basic Structure of the Algorithm The algorithm iterates the number of 10-yen coins from 0 upward. For each value, it computes how many ways the remaining amount can be paid using 1-yen and 5-yen coins, and finally sums all of these results. We also explain why, when using only 1-yen and 5-yen coins, the number of combinations is given by (remaining amount ÷ 5) + 1, and the reasoning behind this formula. Tracing the Program with Concrete Examples We walk through specific examples to illustrate how the algorithm works: 12 yen → 4 combinations 22 yen → 9 combinations By examining each step, you will see clearly how the remaining amount changes depending on whether 10-yen coins are used or not. Why the While-Loop Condition Must Be “rest ≥ 0” A crucial part of the problem is understanding the correct boundary condition in the while loop. The correct condition is: rest ≥ 0 This ensures that the case where the remaining amount becomes exactly 0 yen is counted as a valid combination. If the condition were written incorrectly as: rest > 0 then combinations where the remaining amount is 0 yen would be excluded. For example, for 20 yen, the true number of combinations is 9, but the incorrect condition would output 8. This boundary treatment is the core point of the question. Conclusion In Section B of the FE Examination, it is essential not only to understand program structure but also to accurately follow variable transitions and interpret conditional expressions. Through this video, you will deepen your understanding of algorithms and strengthen your performance in Section B.