随笔分类 - 枚举
摘要:"Zombie's Treasure Chest"
阅读全文
摘要:Overlapping Squares我的思路:可以根据所给图形计算出图形中包含的方块的个数以及它们各自的位置,方块可以根据某一个角点的位置来确定,具体方法见 count() 函数。方块确定之后,图形的各种变化就取决于方块们的不同放置顺序了,枚举所有排列,进行模拟,看...
阅读全文
摘要:Mobile Computing枚举二叉树然后计算其宽度即可,每次枚举两个节点构造一个父节点,计算宽度时需要注意的是每棵树的左节点的右边缘可能超过其右子树的左边缘,反之亦然。#includeusing namespace std;const int maxn = 12...
阅读全文
摘要:Bandwidth注意节点不一定是按字母表顺序从前到后用的,也有可能是A C 却没用B,因为这个TLE了好几次。。#includeusing namespace std;const int maxn = 26;int L,w;char s[100];int seq[m...
阅读全文
摘要:Fractions Again?!x 要用 long long。#includeusing namespace std;const int maxk = 10000;int k;long long x[2*maxk];int y[2*maxk];int judge(i...
阅读全文
摘要:Maximum Product#includeusing namespace std;const int maxn = 20;int n;int seq[maxn];int main(){ // freopen("data.in","r",stdin); ...
阅读全文
摘要:Division#includeusing namespace std;const int maxn = 64 + 5;int n,a[30240][6];int num,kase = 0,cnt = 0;int Pow(int a,int b){ int n ...
阅读全文
摘要:Compound Words我的思路:对于每个单词,依次枚举其所有可能组合的情况,看其两个子单词是否存在于dict中。version 1(30ms):#include#include#include#includeusing namespace std;int mai...
阅读全文
摘要:Urban Elevations书上的思路(离散化):把所有x坐标排序去重,则任意两个相邻x坐标形成的区间具有相同属性,一个区间要么完全可见,要么完全不可见。这样,只需在这个区间里任选一个点(例如中点),就能判断出一个建筑物是否在整个区间内可见。如何判断一个建筑物是否...
阅读全文
摘要:Database思路:只枚举c1和c2,然后从上到下扫描各行。每次碰到一个新的行r,把c1,c2两列的内容作为一个二元组存到一个map中。如果map的键值中已经存在这个二元组,该二元组映射到的就是所要求的r1,而当前行就是r2。在主循环之前先做一个预处理——给所有字符...
阅读全文
摘要:Squaresversion 1(20ms):#include#includeusing namespace std;const int maxn = 10;int n,m,c,H[maxn][maxn],V[maxn][maxn];char readchar(){ ...
阅读全文
摘要:253:Cube painting开始的想法:骰子无论怎么转,每个数字和其对面的数字的对应关系永远不会改变,所以只需要比较两个骰子的三对数字是否相同即可,也的确AC了,但是后来想想不太对。#include#includeusing namespace std;char...
阅读全文
摘要:A character string is said to have period k if it can be formed by concatenating one or more repetitionsof another string of length k....
阅读全文
摘要:总时间限制: 1000ms内存限制: 1024kB描述有一种特殊的二进制密码锁,由n个相连的按钮组成(n#includeusing namespace std;const int maxn = 30;int n;int getBit(int n,int i){ ...
阅读全文
摘要:EXTENDED LIGHTS OUTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12788 Accepted: 8097DescriptionIn an extended version of ...
阅读全文

浙公网安备 33010602011771号