BestCoder Round #81 (div.2)】的更多相关文章

题目链接:BestCoder Round #81 (div.2) 1003 String 题意 中文题,上有链接.就不贴了. 思路 枚举起点i,计算能够达到k个不同字母的最小下标j,则此时有子串len-j个. 将全部起点的值加起来即是结果. 代码 #include<iostream> #include<algorithm> #include<vector> using namespace std; #define LL long long const int MOD =…
题目地址:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=691&pid=1003题意:找出一个字符串满足至少有k个不相同的字母的字串的个数可以注意到 如果 i到j 是满足条件的 则 i到j+1,j+2...n都是满足的,所以可以用尺取法,每次找到满足条件最短的 i,j 然后每次都加上 n-j+1就是答案 #include<bits/stdc++.h> #define inf 0x3f3f3f3f ; u…
总体思路好想,就是在找K个不同字母的时候,卡时间. 看了大神代码,发现goto的!!!!998ms #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<queue> #include<stack> #include<cmath> #include<algorithm> #include<mallo…
B题...水题,记录当前行是由原矩阵哪行变来的. #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<queue> #include<stack> #include<cmath> #include<algorithm> #include<malloc.h> using namespace s…
水题...就是n的三进制后m位 #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<queue> #include<stack> #include<cmath> #include<algorithm> #include<malloc.h> using namespace std; #defi…
Machine Accepts: 580 Submissions: 1890 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Description There is a machine with m(2≤m≤30)m (2\leq m\leq 30)m(2≤m≤30) coloured bulbs and a button.When the button is pu…
HDU:5670~5764 A题: 是一个3进制计数: #include <bits/stdc++.h> using namespace std; ]; int calc(long long n) { ; while(n) { a[i++] = n%; n/=; } return i; } int main() { int t; cin>>t; while(t--) { memset(a,,)); int m; //长度 long long n; cin>>m>&…
对于交换行.交换列的操作,分别记录当前状态下每一行.每一列是原始数组的哪一行.哪一列即可. 对每一行.每一列加一个数的操作,也可以两个数组分别记录.注意当交换行.列的同时,也要交换增量数组. 输出时通过索引找到原矩阵中的值,再加上行.列的增量. 复杂度O(q+mn) #include<cstdio> #include<iostream> #include<vector> #include<set> #include<map> #include&l…
Baby Ming and Weight lifting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 681    Accepted Submission(s): 280 Problem Description Baby Ming is fond of weight lifting. He has a barbell pole(the…
tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 863    Accepted Submission(s): 409 Problem Description There is a tree(the tree is a connected graph which contains n points and n−1 edges),t…