TOJ 1139.Compromise】的更多相关文章

2015-06-03 问题简述: 大概就是输入两段文本(用小写英文字母表示),分别用#表示一段话的结束输入,输出这两个文本的最长公共子序列. 简单的LCS问题,但是输入的是一段话了,而且公共部分比较是字符串的比较. 原题链接:http://acm.tju.edu.cn/toj/showp.php?pid=1139 解题思路: 简单的最长公共子序列问题,只不过过程中比较的是两个字符串,故使用二维字符数组保存输入文本. 输入 x[1...m][], y[1...n][] ,c[i,j]代表两个文本的…
TOJ 2776题目链接http://acm.tju.edu.cn/toj/showp2776.html 这题其实就是考虑的周全性...  贡献了好几次WA, 后来想了半天才知道哪里有遗漏.最大的问题就是, 当零头是13的时候, 不一定前面的光盘都刻录到最大值.比如29,16这种情况, 如果前面的刻录最大值,这样就需要3个盘,而最少的却是 2个就够了,(15,14) 即可:知道这种情况,这题基本就可以了: 注意一下这几个数据: 13 15 输出为2 29 16 输出为2 这条题目看起来很容易,但…
High Performance My SQL  THIRD EDITION A locking strategy is a compromise between lock overhead and data safety, and thatcompromise affects performance. Most commercial database servers don't give youmuch choice: you get what is known as row-level lo…
The blocks in the city of Fishburg are of square form. N avenues running south to north and Mstreets running east to west bound them. A helicopter took off in the most southwestern crossroads and flew along the straight line to the most northeastern…
Description In a few months the European Currency Union will become a reality. However, to join the club, the Maastricht criteria must be fulfilled, and this is not a trivial task for the countries (maybe except for Luxembourg). To enforce that Germa…
2015-06-05 问题简述: 有一个 p*q 的棋盘,一个骑士(就是中国象棋里的马)想要走完所有的格子,棋盘横向是 A...Z(其中A开始 p 个),纵向是 1...q. 原题链接:http://acm.tju.edu.cn/toj/showp1702.html 解题思路: DFS:深搜把所有情况都考虑一遍,当骑士走出棋盘或走到原来走过的格子时,旅行失败了:当骑士能一直走下去直到走过的格子数等于 p*q 时,旅行成功. 提交过程中一直有一个问题使这个代码一直WA,最后才发现是 p.q输入反了…
题目链接:  http://acm.swust.edu.cn/contest/0226/problem/1139/ There is a row of n coins whose values are some positive integers c₁, c₂,...,cn, not necessarily distinct. The goal is to pick up the maximum amount of money subject to the constraint that no…
POJ 2250 Compromise(LCS)解题报告 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87125#problem/D 题目: Description In a few months the European Currency Union will become a reality. However, to join the club, the Maastricht criteria must be fulf…
  Compromise  In a few months the European Currency Union will become a reality. However, to join the club, the Maastricht criteria must be fulfilled, and this is not a trivial task for the countries (maybe except for Luxembourg). To enforce that Ger…
链接:http://acm.tju.edu.cn/toj/showp4123.html 4123.   Job Scheduling Time Limit: 1.0 Seconds   Memory Limit: 65536K Total Runs: 130   Accepted Runs: 29 Given N jobs, each denoted by a 2-tuples integer (pi, ri) where pi is the processing time and ri is…
链接http://acm.tju.edu.cn/toj/showp4117.html 4117.   Happy tree friends Time Limit: 1.0 Seconds   Memory Limit: 65536K Total Runs: 164   Accepted Runs: 60 yuebai has an undirected complete graph with n vertices. He wants to know the minimum spanning tr…
链接:http://acm.tju.edu.cn/toj/showp4120.html 4120.   Zombies VS Plants Time Limit: 1.0 Seconds   Memory Limit: 65536K Total Runs: 268   Accepted Runs: 36 tmeteorj recently is interested in a game Plants VS Zombies like following picture. And his brain…
Jury Compromise Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 33737   Accepted: 9109   Special Judge Description In Frobnia, a far-away country, the verdicts in court trials are determined by a jury consisting of members of the general…
It's not Floyd Algorithm 时间限制(普通/Java):1000MS/3000MS     运行内存限制:65536KByte   描述 When a directed graph is given, we can solve its transitive closure easily using the well-known Floyd algorithm. But if you're given a transitive closure, can you give a…
题目链接: http://poj.org/problem?id=1015 Jury Compromise Time Limit: 1000MSMemory Limit: 65536K 问题描述 In Frobnia, a far-away country, the verdicts in court trials are determined by a jury consisting of members of the general public. Every time a trial is…
1139 First Contact(30 分) Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a girl B, he would usually not contact her directly in the first place. Instea…
题目描述: 已知矩阵的大小定义为矩阵中所有元素的和.给定一个矩阵,你的任务是找到最大的非空(大小至少是1 * 1)子矩阵.比如,如下4 * 4的矩阵 0 -2 -7 09 2 -6 2-4 1 -4 1-1 8 0 -2 的最大子矩阵是 9 2-4 1-1 8 这个子矩阵的大小是15. 输入: 输入是一个N * N的矩阵.输入的第一行给出N (0 < N <= 100).再后面的若干行中,依次(首先从左到右给出第一行的N个整数,再从左到右给出第二行的N个整数……)给出矩阵中的N2个整数,整数之…
Jury Compromise Time Limit: 1000MS   Memory Limit: 65536K Total Submissions:32355   Accepted:8722   Special Judge Description In Frobnia, a far-away country, the verdicts in court trials are determined by a jury consisting of members of the general p…
作为一个oier,以及大学acm党背包是必不可少的一部分.好久没做背包类动规了.久违地练习下-.- dd__engi的背包九讲:http://love-oriented.com/pack/ 鸣谢http://blog.csdn.net/eagle_or_snail/article/details/50987044,这里有大部分比较有趣的dp练手题. hud 2602 01背包板子题 #include<cstdio> #include<iostream> #include<cs…
Description Given N stations, you want to carry goods from station 1 to station N. Among these stations, we use M tubes to connect some of them. Each tube can directly connect K stations with each other. What is the minimum number of stations to pass…
Description As we all know caterpillars love to eat leaves. Usually, a caterpillar sits on leaf, eats as much of it as it can (or wants), then stretches out to its full length to reach a new leaf with its front end, and finally "hops" to it by c…
描述 Two companies cooperatively develop a project, but they don’t like working with one another. In order to keep the company together, they have decided that only one of them will work on each job. To keep things fair, the jobs need to be split so th…
描述 It is an interesting exercise to write a program to print out all permutations of 1, 2, …, n. However, since there are 6227020800 permutations of 1, 2, …, 13, it is unlikely that we would ever run this program on an input of size more than 10. How…
描述 A palindrome is a number that reads the same whether you read it from left to right or from right to left. Here is a surprising fact. Suppose we start with a number n. We reverse the digits of n and add it to n. If this number is a palindrome we s…
1139: [POI2009]Wie https://www.lydsy.com/JudgeOnline/problem.php?id=1139 分析: Dijkstra.状压最短路,dis[i][j]表示到第i个点,状态为j的最短路. 或者 分层最短路可以做. 代码: #include<bits/stdc++.h> using namespace std; typedef long long LL; inline int read() { ,f=;; +ch-';return x*f; }…
http://hihocoder.com/problemset/problem/1139 这题提示上写的是二分,但是感觉不二分应该也可以,至少题目是AC的... 二分的思想就是二分答案的值,看能不能在k步内,得到这个答案值,可以采用bfs来判定. 不二分的话,就是需要一个dis[]数组来保存在前k步内,每个点的最小索敌值,因为bfs在往后的过程中step是越来越大的,所以前面能达到更小的,显然不会重复再跑大的,然后bfs的过程中更新即可.类似于spfa,但是没有对队列去重. 代码: #inclu…
题目链接:http://acm.tju.edu.cn/toj/showp1706.html 很类似Poj的一道帮派的问题,记得找到的可疑的关系,不要将集合刷新就可以了. 1706.   A Bug's Life Time Limit: 5.0 Seconds   Memory Limit: 65536KTotal Runs: 1190   Accepted Runs: 360    Multiple test files Background Professor Hopper is resear…
题目链接:http://acm.tju.edu.cn/toj/showp2469.html 感觉这个题目有点问题,算了不管他了,反正A了. 这里要注意的是求这个集合有多少种,那么就是要剔除重复数后,再数一下有多少个. 难一点的算法我也不会,是帆哥教我的,就是用map<int,bool>,只要maps.find(p)要是没有,就是一个不重复的集合ans++,或者maps.size(); 这个题目的问题在于,father[i]里面存的是根节点,但是,我直接maps.find(father[i])却…
1139 First Contact(30 分) Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a girl B, he would usually not contact her directly in the first place. Instea…
4105.   Lines Counting Time Limit: 2.0 Seconds   Memory Limit: 150000K Total Runs: 152   Accepted Runs: 47 On the number axis, there are N lines. The two endpoints L and R of each line are integer. Give you M queries, each query contains two interval…