Home > Back-end >  Based on backtracking method and problem sets, written in Java
Based on backtracking method and problem sets, written in Java

Time:11-28

Based on backtracking method and problem sets, written in Java, the great god will ah?
Problem description:
Set set S is positive integers, S is a set of no and, if and only if x and y S, contains the x + y does not belong to S,
For any positive integer k, if can {1, 2,... } is divided into n, k and subsets S1, S2,... , Sn,
Said it was the whole k is divisible, n r F (n)=Max {k | k is divisible n},
Try to design an algorithm that for any given n, calculating the value of F (n),
Programming tasks:
For any given n, programming, calculating the value of F (n),

CodePudding user response:

 

The Integer [] Numbers={1, 2, 3};
Var list=Arrays. AsList (Numbers);
Var Max=Collections. Max (list);
  • Related