Sum it up

# Include # include # include int n, m, DP [50], Mark [50], flag; void DFS (int x, int sum) // sum is the sum, X indicates the current array label {int I, K, J, flag1 = 0; If (sum = N) {for (I = 0; I If (sum + dp [J])> N &&! Mark [I]) continue;

Matching brackets (reprinted)

This article is transferred from the Black Water floating cloud space /* DP Solution: f [I] [J] represents the character position to position I, there are J-1 unmatched '(' How many states are there, then f [I] [J] = f [I-1] [J-1] s [I] = '('; f [I]

Enemy army deployment

# Include # include # include int N, C [51100]; int lowbit (int x) {return X &-X;} void add (int x, int I) {While (I It's a tragedy .. The end cannot be entered .. {Scanf ("% d", & M, & N); If (CH [0] = 'A') add (n, m ); else if (CH [0] =

Red and black

# Include # include # include char map [21] [21]; int m, n, Res; int XX [4] = {0, 1,-1 }; int YY [4] = {1,-1, 0}; int fun (int x, int y) {If (x = n | Y> = m) return 0; return 1;} void DFS (int x, int y) {int I, j, X1, Y1; Map [x] [Y] = '#'; for (

Matching strong DFS with parentheses

Xuanzai shenniu black water floating cloud Space # Include # include char s [20]; int sum, L; void work (int K, int CNT) /* CNT is used to record the number of '('') that has not been matched until the current K position. If a negative number is

Priority queue Learning

ADT maximum priority queue abstract data type description abstract data type Maxpriorityqueue { A Finite Element Set of instances. Each element has a priority. Operation Create (): Create an empty priority queue Size (): returns the number of

A = B

#include#includeint main( ){ char a[100020],b[100020],c[100020],d[100020]; while(scanf("%s%s",a,b)!=EOF) { int i,j,k=0,m=0,n=0,len1,len2,f1=0,f2=0,f3=0,f4=0; len1=strlen(a); len2=strlen(b); for(i=0;i This question is really too YD... Not

Download .. carefully analyze various situations

# Include # include /* n the total num is equal. T1 indicates the number of rows. T2 indicates the number of rows in CH2. Likelihood analysis: 1. CH2 is 1, steps 1 t2 = n2.133 is equal to CH2 steps 0 num = n4. Number of reverse steps Steps 1 num = 0

How many tables

# Include # include # include int father [1100]; int find (int x) {return x = Father [x]? X: Father [x] = find (father [x]);} void merge (int x, int y) {x = find (x), Y = find (y ); if (X! = Y) Father [x] = y;} int main () {int P, n, m, d [1100],

Young Artist Grand Prix _ evaluation board score

# Include # include # include int CMP (const void * a, const void * B) {return * (double *) A> * (double *) B? 1:-1 ;}int main () {int N; while (scanf ("% d", & N )! = EOF) {double sum = 0; Double A [10000]; int I; memset (A, 0, sizeof (a); for

HDU 1715 maifo count

The main idea of this question is to output large numbers with strings. First, convert the strings into integer arrays and then convert them into strings .. View code 1 #include 2 #include 3 #include 4 char f[1001][2000]={"1","1","1"}; 5 char sh[20

As easy as a + B HDU 1040 questions

# Include # include # include int CMP (const void * a, const void * B) {return * (int *) A-* (int *) B;} int main () {int N, t; int I, a [1010]; scanf ("% d", & T); memset (A, 0, sizeof (a); While (t --) {scanf ("% d", & N); memset (A, 0, sizeof (

HDU 1181 deformation course

#include#include#includeint map[27][27],visit[26];//const int inf=0x7fffffff;int main( ){char ch[30];int i,j,k,len; memset(visit,0,sizeof(visit));for(i=0;ifor(j=0;j map[i][j]=0;while(scanf("%s",ch)!=EOF) {while(ch[0]!='0') { len=strlen(ch);

AC automatic machine HDU 2222

AC automatic machines are divided into three parts: 1. Construct a dictionary tree 2. Construct the failed pointer 3. Match The problem solved: for example, how many times have the words appeared in this article?View code /* Program description:

XOR algorithm HDU 2095

Exclusive or Algorithm 1. A ^ B = B ^ 2. A ^ B ^ c = a ^ (B ^ c) = (a ^ B) ^ C; 3. d = a ^ B ^ C can release a = d ^ B ^ C. 4. A ^ B ^ A = B. Exclusive or operation 1, exclusive or a mathematical operator. Applies to logical operations. 2.

Gold miner group backpack

Question: N items must be retrieved within t time. Each item has its own time value. The same line must be retrieved in sequence. Algorithm: At first, we used tree-like DP, which is dependent on the backpack .. TLE. In addition, according to the

Multimap .. Awesome

View code // multimap::lower_bound/upper_bound#include #include using namespace std;int main (){ multimap mymultimap; multimap::iterator it,itlow,itup; mymultimap.insert(pair('a',10)); mymultimap.insert(pair('b',121));

Returns the sort function solution HDU 1209

Reprinted Original article: Thanks http://hi.baidu.com/qiaolw/blog/item/c08b245a4a737bca9d820433.html The question is to find the angle between the hour and the minute hand and output the time in the middle. Method for hour and minute hands: Double

Ignatius and the princess ivhdu 1029

#include#include#includeint main( ){long N;while(scanf("%d",&N)!=EOF) {long i=0,j,A[100000],temp,M,flag=1,max=0; M=(N+1)/2; memset(A,0,sizeof(A));for(i=1;i { scanf("%ld",&temp); A[temp]++;if(A[temp]>=M&&flag) { max=temp; flag=0; } }

HDU 3811 DP status Compression

Algorithm: DP [State] [N] indicates the number of the first N bits in the State that are not perfectly arranged. Steps: 1. initialize the 0th-bit value 2. The I-bit is introduced from the I-1-bit, each bit, enumeration (1 3. The answer is n! -DP [(1

Total Pages: 64722 1 .... 55709 55710 55711 55712 55713 .... 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.