Ant financial will go back to the collision. The distance can be worn in pairs, so that the moving distance is good.
The order of the final state ant is the same as that of the initial state.
The rest is to record the label of each ant and simulate it.
1 /*by SilverN*/ 2 #include
Uva10881 Piotr's ants
Greedy, the ant-turn is equivalent to passing through, so in the middle as a distinguishing point, the shortest time is left to go to the left, right to the right, the longest time is left to the right to go, right to the left1#include 2#include 3#include 4 #defineMAXN 10000005 6 using namespacestd;7 8 intt,mint,maxt,n,l;9 intMain ()Ten { Onescanf"%d",T); A while(t--) - { -scanf"%d%d",l,n); the intmid=l/2, A; -Mint=0, maxt=0; - for(intI=0; i) - { +scanf"%d",a);
Title: Uva-10881-piotr ' s AntsThinking: Simulation, as to wear and go through the final state, but the relative order of the same, sort.1#include 2#include 3#include 4#include string.h>5#include 6#include 7 8 using namespacestd;9 Ten Const Chardirname[3][Ten]= {"L","Turning","R"}; One intorder[10010]; A - structAnt - { the intId,position,direct; -} before[10010],after[10010]; - - BOOLcmp (ant x,ant y) + { - returnx.positiony.position; + } A at intMain () - { - intc,cnt; -scanf"%d
Kind Third Kind Fourth Type The first three cases can be a single-stranded way to find out, because the selection of the end-to-end, is not the largest, so the first three kinds of cases is the primary, the last one is the root of the problem, the first set of data, 3, 1, 2, constitute the largest at both ends, so this time to use the second method The maximum value of the first is not the largest, but the minimum value must be the smallest, so, the total minus the sma
position, then 1 to the right of the 0 must be able to change the value of two numbers, that is, the maximum to 5, 6, so the XOR is 3, the binary is 11, so that is 2^2-1 = 3;The code is as follows:1 2#include 3 4 using namespacestd;5 6 intMain ()7 {8 9 Long LongA, B;Ten while(~SCANF ("%lld%lld", a, b)) One { A - Long Longx = a ^b; - intc =0; the while(x) - { -C++; -X >>=1; + } - Long Longres =1; + for(inti =0; I )
Uva_000014
It is equivalent for two ants to move forward after they collide with each other.
# Include # Include String . H> Int Main (){ Int I, J, K, Len, t, n, TT, Max, min;Scanf ( " % D " , T ); For (Tt = 0 ; TT {Scanf ( " % D " , Len, N );Max = min = 0 ; For (I = 0 ; I {Scanf ( " % D " , K );K = k If (K> min)Min = K; If (LEN-k> MAX)Max = len-K;}Printf ( " % D \ n " , Min, max );}Return 0 ;}
ExternalProgram"SQL prompt 3.8" failed to load or caused an exception. Do you want to remove this external program? If "yes" is selected, You need to reinstall the external program to use it again.
Error message: Unknown error
Error code: 8013141a
Reflector is divided into the desktop version and VS integrated version, when we register with the registration of the Standvard version, then our vs can not be integrated view, and can not debug, then thisObviously not what we want, we will choose
Question: give some ant's points, give some tree points, correspond to each other, make their connections do not intersect, and output a scheme.You can assume a combination at will, and then judge it by two. If yes, It is exchanged until all are not
After analysis, the minimum value is the distance between the nearest vertex and its closest endpoint. The maximum value is the larger distance between the minimum vertex and the maximum vertex from the left endpoint.The Code is as follows:
#
First, the number of members in each rank of the ant financial is given, and then the rank of an ant financial ranked X is obtained. Obviously, the ranking of ant financial is ranked by level, and the same level occupies a continuous area.
Reprinted please indicate the source: http://blog.csdn.net/u012860063
Question link: http://uva.onlinejudge.org/index.php? Option = com_onlinejudge & Itemid = 8 & page = show_problem & problem = 4447
PS: This question is super watery, but the
Topic link
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=14347 Topic
There are n n white dots, n n black Dots, to the plane in the N-N-side, to ensure that each side is connected to a white dot and a black dot, and any two edges do
In the ant climbing algorithm, only the time for the ant to exit is obtained, but the time for each ant to exit is not obtained. There is no fixed algorithm here. The Code is as follows:
# Include Using STD: cout; Using STD: Endl; Using STD: swap;
/* Train of Thought: the shortest time is easy and the longest time. The key is to note that the speed of each ant is the same, through equivalent replacement of distance, we can find that what we need is (the rightmost ant-left endpoint) and (the
Suddenly want to learn about the line segment tree, looked at the basic knowledge, and tried a simple line tree topic.
#include #include using namespace std;
const int N = 100010;
struct node {int sum;
int l;
int R;
}; struct node tree[4 * N];
SILVERLIGHT4 or 5 of stand-alone desktop applications, Web applications, Windows Communication infrastructure (WCF) services, and so on. New features include time axis analysis (timeline profiling) and SQL query analysis.
The dottrace extension Visual Studio Gallery Web page provides a very clear, concise product Overview. By watching the overview if you are interested in the product, you can go to the JetBrains website to decide to download or purchase.JetBrains currently offers a free trial
, and can also be used to analyze SILVERLIGHT4 or 5 of stand-alone desktop applications, Web applications, Windows Communication Foundation (WCF) services, and so on. New features include timeline analysis (timeline profiling) and SQL query analysis. The dottrace extension Visual Studio Gallery Web page provides a very clear and concise product Overview. By reading the overview if you are interested in the product, you can go to the JetBrains website and decide to download or purchase it.JetBrai
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.