Description Parentheses Balance You are given a string consisting of parentheses () and []. A string of this type is said to be correct:(a)if it is the empty string(b)if A and B are correct, AB is correct,(c)if A is correct, (A) and [A] is
~~~題目連結~~~code:#include <stdio.h>#include <string.h>#include <iostream>#include <cmath>using namespace std;int a = 0, b = 0, k = 0, x = 0, y = 0;void translate1()//把k進位的數轉化為10進位{ int cnt = 0; x = y = 0;
Problem DescriptionA binary search tree is a binary tree with root k such that any node v reachable from its left has label (v) <label (k) and any node w reachable from its right has label (w) > label (k). It is a search structure which can
Problem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = <x1, x2, ..., xm> another sequence Z = <z1, z2, ..., zk> is a subsequence of X if there exists a
~~~題目連結~~~題目大意:現給出一個區間, 剛開始時區間中的每個點對應的值為1, 現在更新q次, 把x-y區間的點的值全跟新為z, 現在求出整個區間點的值的和。思路:線段樹, 跟新每個區間時只更新到覆蓋的區間, 下回更新時再通過cv【】數組往下更新。code:#include <stdio.h>#include <string.h>#define N 100002using namespace std;int n = 0, x = 0, y = 0, z = 0,
Problem DescriptionLarry graduated this year and finally has a job. He’s making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The
DescriptionYour rich uncle died recently, and the heritage needs to be divided among your relatives and the church (your uncle insisted in his will that the church must get something). There are N relatives (N <= 18) that were mentioned in the
DescriptionBessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get back as quickly as possible. Farmer