TOJ 4393 Game】的更多相关文章

描述 Bob always plays game with Alice.Today,they are playing a game on a tree.Alice has m1 stones,Bob has m2 stones.At the beginning of the game,all the stones are placed on the nodes of a tree,except the root.Alice moves first and they turns moving th…
TOJ 2776题目链接http://acm.tju.edu.cn/toj/showp2776.html 这题其实就是考虑的周全性...  贡献了好几次WA, 后来想了半天才知道哪里有遗漏.最大的问题就是, 当零头是13的时候, 不一定前面的光盘都刻录到最大值.比如29,16这种情况, 如果前面的刻录最大值,这样就需要3个盘,而最少的却是 2个就够了,(15,14) 即可:知道这种情况,这题基本就可以了: 注意一下这几个数据: 13 15 输出为2 29 16 输出为2 这条题目看起来很容易,但…
水题,优先级队列. /* 4393 */ #include <iostream> #include <sstream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <deque> #include <algorithm&g…
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输入反了…
2015-06-03 问题简述: 大概就是输入两段文本(用小写英文字母表示),分别用#表示一段话的结束输入,输出这两个文本的最长公共子序列. 简单的LCS问题,但是输入的是一段话了,而且公共部分比较是字符串的比较. 原题链接:http://acm.tju.edu.cn/toj/showp.php?pid=1139 解题思路: 简单的最长公共子序列问题,只不过过程中比较的是两个字符串,故使用二维字符数组保存输入文本. 输入 x[1...m][], y[1...n][] ,c[i,j]代表两个文本的…
链接: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…
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…
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…