2018年4月27日 星期五

[Note #4][Algorithm] Backtracking

Backtracking: http://acm.nudt.edu.cn/~twcourse/Backtracking.html

Example:
  • Problem: 
    • A ring is composed of n (even number) circles as shown in diagram. Put natural numbers into each circle separately, and the sum of numbers in two adjacent circles should be a prime.
    • Note: the number of first circle should always be 1.
    • You are to write a program that completes above process.
  • AC: https://github.com/Meng-Gen/UVa/blob/master/UVa/acm_524.cc


沒有留言:

張貼留言