Topcoder SRM 634 div.2 [ABC]
ACM
Topcoder SRM 634
After the game, I felt that orz could not be done at the scene. I can't say much about it.
Level one-mountainranges]
Question:Several of the Q A sequences are completely greater than the adjacent peaks.
Analysis:Not much.
Code:
/** Author: illuz
Level Two-ShoppingSurveyDiv2 (Mathematics]
Question:In a survey, N people participated in the survey.
Problem Statement????You are given a string input. you are to find the longest substring of input such that the reversal of the substring is also a substring of input. in case of a tie, return the string that occurs earliest in input.Definition????Class:ReversesubstringMethod:FindreversedParameters:StringReturns:StringMethod signature:String findreversed (string input)(Be sure your method is public)????
Notes-The substring and its reversal may overlap partially or completely.-The entire original
{IntK =-1;DoubleMin =-1;For(IntI = 0; I If(! Flag [I]) {If(K K = I;Min = distance [I];}Else{If(Distance [I] K = I;Min = distance [I];}}}}Flag [k] =True;Count ++;Sum + = min;For(IntI = 0; I If(! Flag [I]) {DoubleD = DIS ((Double) Villagex [I], (Double) Languagey [I], (Double) Villagex [K], (Double) Villagey [k]);If(D Distance [I] = D;}}}}While(Count ReturnSUM;}
Summary
In this case, the first and third questions are the easiest. For the second question, you only need to understand the quest
Topcoder srm296 div1 report
Match date:Monday, 10000l 3, 2006
REPORT Date:Monday, 10000l 10,200 6
Preface:
It is time to reflect on the Performance of div1. This time, several pieces of challenge code were used, but the question still could not be done. It seems that the level is still poor.
Proble m 250-newalbum:
It seems that a simple question can be quickly solved using dynamic rules, but I thought it was simple and adopted a direct calculat
Topcoder srm288 div1 report
Match Date: Wednesday, February 8, 2006REPORT Date: Friday, February 10,200 6
Preface:Maybe it was the first time that the score was too good. The second time it was divided into group Div 1, it was found that its level was really bad. There can only be two coding questions, but the second question is not submitted because it is uncertain. The first question does not pass system test. I tried three questions in the chanlle
goodsubset
Given a value, goodvalue asks the number of subsets of the specified set. The product of each element is equal to goodvalue (empty set is not allowed)
Since goodvalue is within the int range, the approximate number of goodvalue must not exceed 1000
Then, use map to store the number of subsets of V after I processed the first element, and then perform enumeration.
Finally, use a rolling map to process the previous value and the current value ......
When goodvalue is set to 1, the ans
and "little money ", it's already 03 years for him ~ At that time, he had nine jobs in May ~ Earn 100 ~ 200 knives. Then he started designing, featuring a small workload and a large amount of money. It was mainly for him in 500 years, and he could earn ~ 1500 knives. Then he started his most profitable job and made Reviewer! This work is characterized by a very small workload, a lot of money, a 200 ~ 1000 knives. He did 20 in October at most and earned 8000 yuan .... The experience of cool peop
Question: Give a vertex (x, y), give some step delta1, delta2... deltan: Can I reach the (x, y) point after completing n steps in strict accordance with the step (0, 0.
Solution: in fact, it is to determine whether these line segments and (0, 0)-(x, y) can constitute a multilateral (angle ?) You only need to judge whether the longest side is less than half of the length of all sides.
Code:
#include View code
Topcoder SRM 633 div.2 500 jumping
[0]=0;So the latter sentence is saying, take out the low 16 bits of I.And then we'll be able to preprocess this value quickly.We also used a __builtin_popcount, (note that there are two underscores in front ...) ), this is a built-in function: Do not need a header file, this function is still the thief fast.He can quickly figure out how many bits 1 of a number.In addition: string is preceded by std::Put the code below.#include #include#includestring.h>#include#definell Long Longclassthuemorsegam
the line is straight, then for a grid within the railway must be linked horizontally or vertically linked, then we have all the small animal points to split two points, representing the matching horizontal row and matching vertical line, and then for the two matching degrees are matched to the same direction can be easily counted.See the code for the concrete map.Code (no cost Flow section):intp[ -][ -],n,m,fix,fix2,mk[ -][ -],sz; intWT,BL; intGetmin (vectorstring>field) {S=maxn-2; t=maxn-3; cn
#defineEPS 1e-9#defineAll (x) X.begin (), X.end ()#defineINS (x) Inserter (X,x.begin ())#definefor (i,j,k) for (int i=j;i#defineMAXN 1005#defineMAXM 40005#defineINF 0X3FFFFFFFusing namespaceStd;typedefLong LongLL; LL I,j,k,n,m,x,y,t,big,cas,num;BOOLFlag; LL Cur,ans;BOOLprim[2000005]; LL ver[2000005]; voidGetprim (ll size) {ll m=SQRT (size+0.5); memset (Prim,0,sizeof(prim));//can be emptied according to the situationnum=0;//put the found prime number in the Ver array, num is the length of the ver
First question, http://community.topcoder.com/stat?c=problem_statementpm=13462rd=16076.The simulation is ready.#include The second question, thought for a long time. Finally, we find that the a+b>=c of the triangle, a push, can introduce the distance range of the polygon (opening) composed of n edges. Http://apps.topcoder.com/wiki/display/tc/SRM+633#JumpingThere are detailed illustrations.#include The third question, did not do. Later see the puzzle, is to use the LCD and gcd restrictions, get x
The first question: K equals 1 or 2, very simple. Slightly. K more situations, http://www.cnblogs.com/lautsie/p/4242975.html, worth thinking about.Question two: http://www.cnblogs.com/lautsie/p/4245242.htmlBFS and DFS can, note that when writing, you can go to que a few things together, you do not have to set up objects. Blocked and visited can also be recorded directly using a two-dimensional matrix.Pruning what, the most basic is to find the actual step limit of the case, the chessboard is bou
http://community.topcoder.com/stat?c=problem_statementpm=13628rd=16278The standard process is BFS, I use DFS, can be solved.Here the complex pair write a hash function, in fact, directly with a matrix to save bool can be.#include [TopCoder] Thegriddivtwo
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.