TC SRM 663 div2 B AABB 逆推】的更多相关文章

AABB Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 TC Description One day, Jamie noticed that many English words only use the letters A and B. Examples of such words include "AB" (short for abdominal), "BAA" (the noise a sheep makes), &…
ChessFloor Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 TC Description Samantha is renovating a square room. The floor of the room is an N times N grid of unit square tiles. Each tile has some color. You are given the current colors of all tiles in a…
LuckyXorTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 TC Description A lucky number is a positive integer consisting of only the digits 4 and 7.Given an int a, return an int b strictly greater than a, such that a XOR b is a lucky number. (See Notes fo…
很棒的DP,不过没想出,看题解了..思维很重要. #include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <cmath> #include <algorithm> using namespace std; ]; ]; class MayTheBestPetWin { public : int calc(vector <…
很不错的一题,非常巧妙的用DP顺序解决这个问题... 可以发现,只和A里面最小的有关系... #include <cstdio> #include <cstring> #include <queue> #include <string> #include <vector> #include <algorithm> using namespace std; #define LL long long *+]; vector<int&…
100的数据直接暴力就行,想多了... ac的代码: #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <vector> #define LL __int64 +; using namespace std; int a[maxn]…
BearPlaysDiv2 Problem Statement    Limak is a little bear who loves to play. Today he is playing by moving some stones between three piles of stones. Initially, the piles contain A, B, and C stones, respectively. Limak's goal is to produce three equa…
 BearCheats Problem Statement    Limak is an old brown bear. Because of his bad eyesight he sometimes has to visit his doctor, Dr. Carrot. Today is one such day. Dr. Carrot has a blackboard in his office. There is a number A written on the blackboard…
LuckyCycleTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87326#problem/B Description This problem is about trees. A tree consists of some special points (called nodes), and some lines (called edges)…
求拼接完成后的字符串包含的子回文串的数目,一开始还用暴力去做,想都不用想 肯定超时了. 复习了一下求最长子回文串的算法,发现可以类似解决. 给相邻字符之间添加一个'@'字符,这样所有的回文串都是奇数长度,然后从左到右,统计以每个字符为中心的回文串的数目就行了,长度逐渐递增,一旦遇到不是回文串的情况,就马上结束,开始对下一个字符为中心的回文串的统计. Orz-这个回文串算法不久前学过,最近搞前面基础去了就忘得差不多了,还是太弱了,继续好好努力,先打好基础,同时学点新东西,我就不相信,acm这东西花…