数据结构
文章平均质量分 61
Code_Diary
人生是修炼的过程
展开
-
UVA - 12657
#include#includeusing namespace std;int left[100005], right[100005]; void link(int l, int r) { left[r] = l; right[l] = r;} int main(){ int test = 0, op, x, y, temp, n, m转载 2017-06-07 15:43:43 · 193 阅读 · 0 评论 -
UVA - 673
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)原创 2017-06-07 15:38:28 · 257 阅读 · 0 评论 -
UVA - 133
In a serious attempt to downsize (reduce) the dole queue, The New National Green Labour RhinocerosParty has decided on the following strategy. Every day all dole applicants will be placed in a largeci原创 2017-06-07 15:33:35 · 245 阅读 · 0 评论 -
UVA - 101
题解:#include#include#include#includeusing namespace std;void initi(int place[], int blocks[][30], int top[], int x){ while(blocks[place[x]][top[place[x]]] != x) { int now = blocks[place[x]][原创 2017-06-07 15:31:34 · 355 阅读 · 0 评论 -
POJ - 3750
有N个小孩围成一圈,给他们从1开始依次编号,现指定从第W个开始报数,报到第S个时,该小孩出列,然后从下一个小孩开始报数,仍是报到S个出列,如此重复下去,直到所有的小孩都出列(总人数不足S个时将循环报数),求小孩出列的顺序。Input第一行输入小孩的人数N(N接下来每行输入一个小孩的名字(人名不超过15个字符) 最后一行输入W,S (W Output按人名输出小孩按顺原创 2017-06-07 15:24:39 · 396 阅读 · 0 评论 -
HDU - 1443
The Joseph's problem is notoriously known. For those who are not familiar with the original problem: from among n people, numbered 1, 2, . . ., n, standing in circle every mth is going to be executed原创 2017-06-07 15:21:33 · 265 阅读 · 0 评论 -
HDU - 1870
四月一日快到了,Vayko想了个愚人的好办法——送礼物。嘿嘿,不要想的太好,这礼物可没那么简单,Vayko为了愚人,准备了一堆盒子,其中有一个盒子里面装了礼物。盒子里面可以再放零个或者多个盒子。假设放礼物的盒子里不再放其他盒子。 用()表示一个盒子,B表示礼物,Vayko想让你帮她算出愚人指数,即最少需要拆多少个盒子才能拿到礼物。 Input本题目包含多组测试,请处理到文件结束原创 2017-05-30 17:42:27 · 256 阅读 · 0 评论 -
HDU - 1237
读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值。 Input测试输入包含若干测试用例,每个测试用例占一行,每行不超过200个字符,整数和运算符之间用一个空格分隔。没有非法表达式。当一行中只有0时输入结束,相应的结果不要输出。 Output对每个测试用例输出1行,即该表达式的值,精确到小数点后2位。 Sample Input1 + 24转载 2017-05-30 17:38:35 · 360 阅读 · 0 评论 -
HDU - 1022
As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all over t原创 2017-05-30 17:37:25 · 248 阅读 · 0 评论 -
HDU - 1702
ACboy was kidnapped!! he miss his mother very much and is very scare now.You can't image how dark the room he was put into is, so poor :(. As a smart ACMer, you want to get ACboy out of the monst原创 2017-05-30 17:35:10 · 283 阅读 · 0 评论 -
HDU - 1020
Given a string containing only 'A' - 'Z', we could encode it using the following method: 1. Each sub-string containing k same characters should be encoded to "kX" where "X" is the only character i原创 2017-05-30 17:29:05 · 408 阅读 · 0 评论 -
POJ - 1363
There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was possible to e原创 2017-05-30 17:01:48 · 296 阅读 · 0 评论 -
UVA - 11988
You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problemwith the keyboard is that sometimes the “home” key or the “end” key gets automatically pressed(internal转载 2017-06-07 15:40:22 · 224 阅读 · 0 评论