摘要:Matrix Chain MultiplicationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 620Accepted Submission(s): 426Problem DescriptionMatrix multiplication problem is a typical example of dynamical programming. Suppose you have to evaluate an expression like
阅读全文
摘要:RailsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 18531Accepted: 7391DescriptionThere 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 establish
阅读全文
摘要:Bad Hair DayTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 10202Accepted: 3412DescriptionSome of Farmer John's N cows (1 ≤ N ≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see the top
阅读全文
摘要: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 the world ^v^). But here comes a problem, there is only one railway where all the trains stop. So all
阅读全文
摘要:#include #include #include #include #include #include using namespace std;int main(){queue Q;stack S;int i;for(i=1;i M //例如 queue Q,q,、、查看是否为空范例 M.empty() 是的话返回1,不是返回0;从已有元素后面增加元素 M.push()输出现有元素的个数 M.size()显示第一个元素 M.front()显示最后一个元素 M.back()清除第一个元素 M.pop()入栈,如例:s.push(x);出栈,如例:s.pop();注意,出栈操作只是删除栈顶元.
阅读全文
摘要:愚人节的礼物四月一日快到了,Vayko想了个愚人的好办法——送礼物。嘿嘿,不要想的太好,这礼物可没那么简单,Vayko为了愚人,准备了一堆盒子,其中有一个盒子里面装了礼物。盒子里面可以再放零个或者多个盒子。假设放礼物的盒子里不再放其他盒子。用()表示一个盒子,B表示礼物,Vayko想让你帮她算出愚人指数,即最少需要拆多少个盒子才能拿到礼物。Input本题目包含多组测试,请处理到文件结束。每组测试包含一个长度不大于1000,只包含'(',')'和'B'三种字符的字符串,代表Vayko设计的礼物透视图。你可以假设,每个透视图画的都是合法的。Outpu
阅读全文