Skip to content
← All questions

Why can the gcd function be called directly in the video, but might need to be written manually in exams?

The gcd function can be called directly in the video because the instructor is using a relatively new C++ version that includes it as a built-in feature. However, exam environments may use older C++ compiler versions that do not support this built-in function, requiring candidates to implement the gcd logic manually.

Conditions

  • The video uses a newer C++ standard.
  • Exam environments may use older C++ standards.

Reasoning, step by step

  1. Identify that the video uses a modern C++ environment.
  2. Note the instructor's warning about exam compiler versions.
  3. Conclude that manual implementation is safer for exams to ensure compatibility.

Example

The instructor states: "I directly used the gcd function here because my C++ version is relatively new now... But during exams, the C++ compiler version might not be this new, so you may need to implement the gcd function yourself during exams."

Common misconceptions

  • Assuming that all C++ compilers automatically support the latest standard library features.
  • Thinking that using built-in functions is always the best practice in competitive programming without checking the environment.

Watch the explanation

Connected concepts

Explore next

Related questions

Meet the concept

↗
Find a method

↗
Find a method

↗
Find a method

↗
Meet the concept

↗

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.