- 博客(18)
- 收藏
- 关注
原创 【ural oj 1009】K-based Numbers(数位dp)
1009. K-based NumbersTime limit: 0.5 secondMemory limit: 64 MBLet’s consider K-based numbers, containing exactly N digits. We define a number to be valid if its K-based notation doesn’t contain two su...
2018-05-31 12:57:55 225
原创 【HDU 3342】Legal or Not(拓扑排序)
Legal or NotTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10348 Accepted Submission(s): 4843Problem DescriptionACM-DIY is a large QQ group ...
2018-05-31 12:46:29 162
原创 【HDU 1285 】确定比赛名次(拓扑排序)
确定比赛名次Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 33795 Accepted Submission(s): 13254Problem Description有N个比赛队(1<=N<=500),编号依次为1,2,...
2018-05-30 17:45:47 193
原创 【poj 3267】The Cow Lexicon(DP)
The Cow LexiconTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 11319 Accepted: 5415DescriptionFew know that the cows have their own dictionary with W (1 ≤ W ≤ 600) words, each containing no ...
2018-05-29 10:55:55 119
原创 【POJ 1837】Balance(DP)
BalanceTime Limit: 1000MS Memory Limit: 30000KTotal Submissions:16036 Accepted: 10090DescriptionGigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other...
2018-05-28 22:17:11 177
原创 匈牙利算法
#include<iostream>#include<algorithm>#include<string.h>using namespace std;#define MAXN 1000int um,vm;int n,m;int g[MAXN][MAXN];int linked[MAXN];int vis[MAXN];int find(int...
2018-05-25 18:01:35 192
原创 树状数组求区间和
#include<iostream>#include<algorithm>#include<string.h>using namespace std;#define MAXN 10005int c[MAXN];int a[MAXN];int n; int lowbit(int x){ return x&(-x);}void ...
2018-05-25 16:51:48 1067
原创 中国剩余定理
#include<iostream>#include<algorithm>using namespace std;#define MAXN 1000005typedef long long ll;ll m[MAXN],a[MAXN];ll n;void exgcd(ll a,ll b,ll &x,ll &y){ if(!b) { x=...
2018-05-25 12:48:34 214
原创 【51NOD 1006】最长公共子序列Lcs(DP+回溯)
1006 最长公共子序列Lcs 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。比如两个串为:abcicbaabdkscabab是两个串的子序列,abc也是,abca也是,其中abca是这两个字符串最长的子序列。Input第1行:字符串A第2行:字符串B(A,B的长度 <= 1...
2018-05-17 16:24:29 277
原创 【FZUOJ 1046】Tempter of the Bone(DFS加奇偶剪枝)
Accept: 623 Submit: 1734Time Limit: 1000 mSec Memory Limit : 32768 KB Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, th...
2018-05-16 22:53:14 136
原创 【ural oj 1005】Stone Pile(01背包)
1005. Stone PileTime limit: 1.0 secondMemory limit: 64 MBYou have a number of stones with known weights w1, …, wn. Write a program that will rearrange the stones into two piles such that weight differ...
2018-05-13 21:37:34 715
原创 【HDU 1021】Fibonacci Again(矩阵快速幂水题)
Fibonacci AgainTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 69786 Accepted Submission(s): 32055Problem DescriptionThere are another kind o...
2018-05-11 13:51:55 258
原创 【POJ 3070】Fibonacci(矩阵快速幂)
FibonacciTime Limit: 1000MS Memory Limit: 65536KTotal Submissions:18114 Accepted: 12587DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, th...
2018-05-10 19:06:18 177
原创 【板子--矩阵快速幂】
其实矩阵快速幂和普通快速幂没有什么区别,就是把单个数据改成矩阵,我们只需要能够写出矩阵乘法即可,然后按照快速幂的老套路就行了;#include<iostream>#include<algorithm>using namespace std;#define MAXN 120const int mod=1e9+7;typedef long long ll;int n...
2018-05-10 18:32:50 506
原创 【codeforces 479DIV.3】A B C E题解
A. Wrong Subtractiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle girl Tanya is learning how to decrease a number by one, but she does it ...
2018-05-07 17:24:13 423
原创 【LightOj 1220】Mysterious Bacteria (唯一分解定理)
J - Mysterious Bacteria LightOJ - 1220 这道题要用到唯一分解定理,n=p1^e1*p2^e2*p3^e3...(p1,p2,p3..),最终答案应该为gcd(e1,e2,e3,...);(1)先打一个素数表(2)直接求出e1,e2,e3...(3)判断n是否是负的,若为负数,则需要先将其转化成为正数(PS:如果n为负数,那么ans一定是奇数,所以最后还要进行一...
2018-05-04 20:06:41 253
原创 【hdu 1257】最少拦截系统(最长递增子序列问题)
最少拦截系统Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 53161 Accepted Submission(s): 20836Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦...
2018-05-04 08:02:57 164
原创 【hdu1050】Moving Tables
Moving TablesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 40356 Accepted Submission(s): 13294Problem DescriptionThe famous ACM (Advanced C...
2018-05-01 21:37:46 215
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人