5 2 1 5 2 1 5 2 1
1 2 3 4
5 The question ： Yes n Duan stick , Request this n It's made of two sticks x A stick of the same length , Make the new stick as short as possible , Output min ？ Ideas ： Search for , The length of the new stick must be greater than or equal to the maximum of the original stick maxlen, Less than or equal to the total length of these sticks sum, So growing up （maxlen~sum） Traverse these values , If sum%i!=0 , You can't make a legal stick and jump over it ;
If sum%i==0, Then it's possible to satisfy , Search . search process ： Deep search one by one , The record has been put together into several sticks at present , How long is it from the stick , Used sticks v[i] marked . The code is as follows ：
using namespace std;
int v; int check(int num,int rest,int pos)
if(num==sum/start) return ;
for(i=; i>=; i--) if(v[i]) break;
for(int i=rest; i>=; i--)
if(flag) return ;
} int main()
for(int i=; i<=n; i++)
int x; scanf("%d",&x);
for(start=maxn; start<=sum; start++)
21 16 33 36 19 1 35 6 47
46 16 47 31 22 48 10 47 25 48 33 31 35 33 14 21 8 22 20 37 20 48 8 18 3 44 28 16 9 50 44 18 46 28 43 49 18 19 31 46 3 43 43
4 2 1 6 6 5 6 9 1 0 6 9 0 4 8 3 2 1 1 6
6 8 9 4 5 10 6 5 8 5 5 7 9 6 3 10 3 1 9 9
- POJ 1011 sticks Search for
Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 125918 Accepted: 29372 Descrip ...
- Search for + prune ——POJ 1011 Sticks
Search for + prune --POJ 1011 Sticks Blog classification : Algorithm Very classic search topic , The first time I did it was during summer training , I turned it out the day before yesterday Originally, I wanted to feel something , I don't want to build on the original idea , I made it, and it's still 0 ...
- DFS( prune ) POJ 1011 Sticks
Subject portal /* The question : Some sticks , It is made of several long sticks of the same length , Ask the length of the smallest original long stick : DFS prune : A good topic for pruning search !TLE Several times , Finally the pruning is complete ! Pruning is mainly in 4 and 5:4 Sticks of the same length are no longer searched ...
- POJ 1011 - Sticks DFS+ prune
POJ 1011 - Sticks The question : A piece of wood of equal length is cut randomly into n A little piece of wood Given their respective lengths , What is the minimum possible length of these sections analysis : 1. The length must be divisible by the total length ...
- OpenJudge 2817: stick / Poj 1011 Sticks
1. Link address : http://bailian.openjudge.cn/practice/2817/ http://poj.org/problem?id=1011 2. subject : Total time limit : 1000m ...
- POJ 1011 Sticks 【DFS prune 】
Topic link :http://poj.org/problem?id=1011 Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissio ...
- POJ 1011 Sticks（ Search for && prune && classic ）
The question : Yes n A stick (n<=64), They're cut from sticks of the same length , Given this n The length of a stick , Find the minimum value that makes the original length possible . analysis : A classic deep search topic , We found that the answer could only be a factor of the sum of the lengths of all the sticks , ...
- poj 1011 Sticks （DFS+ prune ）
Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 127771 Accepted: 29926 Descrip ...
- POJ 1011 Sticks dfs, prune difficulty :2
http://poj.org/problem?id=1011 To divide a given set into several sets , The sum of each set ans equal , And ans Minimum , Because this and ans Only in [1,64*50] Inside , So it can be used dfs One try First ...
- POJ 1011 Sticks（dfs+ prune ）
http://poj.org/problem?id=1011 The question : Several sticks of the same length are cut into sticks of different lengths , Find the original minimum possible length of each stick . Ideas : It's a classic search question . I started with all kinds of overtime , This problem needs a lot of pruning ...
- ASP.NET about excel Data import into database
//*******************************C#(UI Code )********************************/ Web Put one on the interface FileUpload The name is :F ...
- USACO Section 2.1: Hamming Codes
It's a very simple question /* ID: yingzho1 LANG: C++ TASK: hamming */ #include <iostream> #include <fstream> ...
- iOS OpenCV The lack of 64 Bit solution
- Aurora push , Aurora IM Use guide （AndroidStudio）
Go to the official website to create an application , Then download the above example program , Compare to the integration document , hold libs Inside jar and so Put the file into the libs below , Remember to jar want as a library, Then configure the manifest file , In contrast to Demo Come on , Well configured ...
- Remmarguts' Date POJ - 2449 （A* Search for |k A short circuit ）
"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. ...
- Swift Type bridging
Preface iOS Medium API Basically, it was many years ago OC written , Now by bridging in Swift Can be used in the , I can't see the difference , It's very natural . But some special types , Special attention should be paid when bridging two languages . 1.N ...
- POJ 2391 Ombrophobic Bovines （Floyd + Dinic + Two points ）
Ombrophobic Bovines Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11651 Accepted: 2 ...
- oracle Create simple packages
-- standard create or replace package test_pkg is --test_pkg For the package name procedure showMessage; -- Declare a process function my ...
- Use ZooKeeper Realization Java Span JVM Distributed locks for ( Read-write lock )
One . Use ZooKeeper Realization Java Span JVM Distributed locks for Two . Use ZooKeeper Realization Java Span JVM Distributed locks for ( Optimize the idea ) 3、 ... and . Use ZooKeeper Realization Java Span JVM Distributed locks for ( Read-write lock ) Reading and writing ...
- Network connection and initial HTTP request
The browser searches the web page , First from URL Start , Use DNS determine IP Address , And then based on TCP and HTTP Protocol to connect to the server , Request related content , Get the corresponding , The browser parses and presents it to the screen . After the server responds , Browser responses don't all arrive at the same time , It will come one after another ...