Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在解决一个问题,要求我输出满足某些条件的数字列表。得分取决于输出的大小(因为它是部分评分问题)。我如何限制我的代码继续输出数字,直到它达到时间限制。
看起来明显的结构是这样的:
while (current_time < end_time) { current_number = *next_number++; if (meets_conditions(current_number)) output(current_number); }