Several better hash Methods

[Hash function] // 1. the first hash method is typedef long ll; const int hashmax = 1000003; ll hash [hashmax]; // y, W is the two values to be hashed int makehash (INT y, int W) {ll situ = (LL) Y

Usaco American heritage

This question can be used to practice coding! CodeAs follows: /* ID: Guo geerprog: heritagelang: c ++ */# include # include # include # include # include using namespace STD; struct node {char V; node * left; node * right;}; int Len; char

Miscellaneous (1) Graph Theory

1. degree sequence of a graph Definition: If V (G) = {V1, V2, V3 ,..., VP}; it is called a non-negative integer sequence (D (V1), D (V2), D (V3 ),..., D (VP) is the degree sequence of graph G. (a graph in the definition refers to a generalized

Usaco A Game

I haven't written any questions for a long time ...... Haha! This is a DP problem, which is relatively simple! The Code is as follows: /*ID: guo geerPROG: game1LANG: C++*/#include#include#include#includeusing namespace std;int dp[210][210];int

Usaco Sweet Butter

This is also a simple graph theory problem! You can use the Floyd algorithm! Haha ...... Good code: /*ID: guo geerPROG: butterLANG: C++*/#include#include#include#includeusing namespace std;#define MAXN 10000000int pas[1000];int dist[1000][1000];int

HDU4277 search pruning

This... practice search... I can't write my own hash... sad reminder... /********************HDU 4277Sevenster2012.09.12********************/#include#include#include#include#define HashSize (1se;bool judge( int a,int b,int c ){ if(

Usaco Riding the Fences

This question is very interesting ...... Good code: /*ID: guo geerPROG: fenceLANG: C++*/#include#include#include#includeusing namespace std;int a[510][510],b[510],path[1029],stack[1029];int getMin(int s[]){ for(int i=1; i 0) return i; return -

POJ 1408 slag calculation ry

For the first time, I wrote a program in ubuntu, and after a long time, I was able to write something. From Installing the operating system, compiling the software, compiling the environment... I feel like I am weak... I have been calling a question

Usaco Electric Fence

This question is relatively simple. However, pay attention to the following special situations: Also, remove the intersection points. The Code is as follows: /*ID: guo geerPROG: fence9LANG:

Codeforces Round #116 E-Cubes 180E

E. Cubestime limit per test 1 secondMemory limit per test 256 megabytesInput Standard inputOutput Standard output Let's imagine that you're playing the following simple computer game. The screen displaysNLined-up cubes. Each cube is painted

A typical DP water question-the longest common subsequence POJ 2250

I did not write this article because I think there are too few materials for the longest public subsequence, It was such a familiar problem that I finally found the bug after WA all morning, Lessons learned from the morning's pain: as a programmer,

BFS + A little mathematical HDU1226 super Password

Super Password Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission (s): 1618 Accepted Submission (s): 489Problem DescriptionIgnatius spent a week finally finding the legendary treasure where the

Sgu 438 The glorous Karlutka River =) (dynamic network Stream)

M people are on the south bank of a river w in width. Now they are going to the opposite side. It is known that there are n stones in the river. Each rock can only accommodate ci people at the same time, each person can jump to the distance d at a

HDU3397 Sequence operation (line segment tree)

Click to open the question link. There is also a similar question, which only performs the 01 flip operation and the maximum continuous query, HDU3911Black And White Perform the following operations on a sequence: Change operations: 0 a B change all

Poj 2843 Cutting Cake

Q: a n * N big cake was interrogated M times. Each time a rectangle was cut, I asked how many blocks were divided into each cut rectangle (1 Solution: it is clear that the number of connected components in a region is obtained. Because the elements

Spoj 3196 Divisibility Relation (Maximum Independent Set output Scheme)

Question: Give 200 numbers and select the largest subset so that the numbers in the subset do not divide each other. Solution: Split the vertices and edges that can be divisible. It looks like the largest independent set of an undirected graph. The

Hdu 3873 Invade the Mars (self-writing heap optimization Dijkstra)

City 1 is the starting point and city n is the destination. There are several restrictions: you must first take City a to take City B. Ask the shortest time required to take city n. The shortest path from the source point to any point is restricted

Several special spanning trees

1. (strict) generation of small trees Solution: 1. delete the edges in the tree in sequence and then obtain the minimum spanning tree. When determining that the Spanning Tree is unique, you only need to delete the edges with the same length as the

POJ2892 Tunnel Warfare (line segment tree)

Click the open question link to perform three operations and inquiries on consecutive villages. D x:X-Th village was destroyed. Q x: The Army commands requested the number of commands ages thatX-Th village was directly or indirectly connected

Hdu 4358 Boring counting

Question: Give a tree. Each vertex has a vertex weight. Then, ask how many kinds of weights of the Child tree with x as the root appear exactly k times. I am too lazy to answer questions directly. Besides, I did not write it myself. #include

Total Pages: 64722 1 .... 56328 56329 56330 56331 56332 .... 64722 Go to: GO

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.