Home > Back-end >  Learn JAVA construction BIM engineer for help ask god to help solve
Learn JAVA construction BIM engineer for help ask god to help solve

Time:09-30

If I have 50 steel bar, length is differ because of my bar is 12 meters entire length approach, in order to reduce the waste, I need to arrange their integration, and which two together the most close to 12 meters (not more than 12 meters to extract) some 12 meters short three root can gather together, and extract them output, output to the database is in each group respectively the bar code, I need to input in the eclipse is every length of root reinforcement, creating these objects, finally can view the results in the MySQL database, have great god have ideas?

My idea is to use no. 1 steel bar respectively at the back of the 49 steel bar, ask us a, 12 - a> judgement;=0 and compare the size of the 49 a, taking the minimum, the minimum value of a corresponding reinforcement is the best match with 1, then find and 2 the best match of reinforcing steel bar, and so on

Didn't know that I the idea is not correct, or to have a great god has a better idea, because I have only learned a few months of JAVA, a great god can give the code, just as a small interesting topic to the great god,,,

CodePudding user response:

If two addition, the overall train of thought should be the first to all steel bar length, sorting, and then the shortest and longest addition, if more than 12, carry on and second longest shortest addition, by analogy, when less than 12, long number is the minimum number of matches, then a second shorter and smaller than the front short matching to the long steel 筯 addition, reason, can match with the shortest second match not more, in short, for example: 2,3,3,4,5,5,6,10,11,2 + 11, do not match, continue to 2 + 10, then 3 + 6, 11 have can be ignored
  • Related