#include <iostream> #include <vector> #include <algorithm> using namespace std; class LittleElephantAndBooks{ public: int getNumber(vector<int> pages,int number){ sort(pages.begin(),pages.end()); int res = pages[number]; ; i < n…
#include <iostream> #include <vector> #include <algorithm> #include <iterator> #define LL long long using namespace std; class LittleElephantAndPermutationDiv2{ public: LL getNumber(int N, int k){ LL res = ; vector<int> a(N);…
昨天下午查看邮箱,看到了topcoder的SRM比赛通知和cf的比赛通知,当时什么也不想做,心里空荡荡的,忽然就想参加一下,试试看.吃完晚饭回来一看,就剩十几分钟了,匆忙把平台下了,就开始等待比赛开始了.话说这是第一次在topcoder比赛,以前一直都不想的,认为自己水平不够,参加比赛也是找虐,想把水平提高一下再比赛,可是...直到现在还是菜鸟一只...汗颜... 以前也在tc上练习过了,貌似做了一道题...不过后来重装系统了,所有插件.配置都没了,等到比赛开始,我就有点傻了,写类写方法...?…
\(>Topcoder \space Srm \space 673 \space Div2 \space 1000 \space BearPermutations2<\) 题目大意 : 对于一个长度为 \(n\) 的排列,定义其的贡献为对其建笛卡尔树,树上有两个儿子的节点其左右儿子在原排列中的距离之和,给出 \(n, Mod\),求所有长度为 \(n\) 的排列的贡献之和对 \(Mod\) 取模的值 \(1 \leq n \leq 100\) 解题思路 : 考虑一个最暴力的 \(dp\) ,设…
\(>Topcoder \space Srm \space 671 \space Div2 \space 1000 \space BearDestroysDiv2<\) 题目大意 : 有一个 \(W \times H\) 的网格,每一格上有一棵树和一个随机字母 \(S\) 或 \(E\) ,有一只熊在左上角,按从上到下从左到右的顺序遍历每一行每一列,如果其遇到一棵可以推倒的树,就尽可能按照字母表示的方向 (向下,向右) 推倒它,然后其推倒方向的下一棵树就不能被推倒了,同时树不能被推倒在边界之外…
周赛时遇到的一道比较有意思的题目: Problem Statement      There are N rooms in Maki's new house. The rooms are numbered from 0 to N-1. Some pairs of rooms are connected by bidirectional passages. The passages have the topology of a tree. That is, there are exactly N-…
脑洞太大,简单东西就是想复杂,活该一直DIV2; A:水,基本判断A[I]<=A[I-1],ANS++; B:不知道别人怎么做的,我的是100*N*N;没办法想的太多了,忘记是连续的数列 我们枚举公差,找到能有多少就可以了. C:想到MAP,但是前面太脑掺,只有几分钟写.. 不过还真不一定写的出来.. 进来DP感觉良好.. 我们可以发现其实这些的乘积其实比较少.. 然后就像普通数组进行加法一样. #include <cstdlib> #include <cctype> #in…
先用dfs搜索所有的情况,然后判断每种情况是不是括号匹配 #include <vector> #include <string> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <func…
题目比较简单. 注意看测试用例2,给的提示 Please note that this is the largest possible return value: whenever there is a solution, there is a solution that uses at most two moves. 最多只有两步 #include <vector> #include <string> #include <list> #include <map&…
贪心的题,从左向右推过去即可 #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #i…