摘要: 此题不难,但我就是RE,搞不懂啊。。。郁闷。说下基本算法吧,只要留意到要分解的因式是(x+ai)..的形式,x前是系数为1的,而且,它们的绝对值在1000以内,于是,好办了。只要枚举(x+k)中的k就可以了。然后按照除法得出余下的因式就OK了。注意结束的条件,最高次必须系数是1,结束后0次的也应当是... 阅读全文
posted @ 2015-03-26 21:47 chenjunjie1994 阅读(125) 评论(0) 推荐(0)
摘要: 真是神奇,G++TLE,C++500MS。。。判环有一个图论知识就是,m>=n时必有环。如果以m的范围建图,会MLE。然后,利用拓扑排序再来判定是否有环,因为有些景点可能是孤立的。同时,在拓扑时就可以DP求最长路了。#include #include #include #include #defin... 阅读全文
posted @ 2015-03-26 11:52 chenjunjie1994 阅读(127) 评论(0) 推荐(0)
摘要: 直接DP求组合数即可。#include #include #include #include #define LL __int64using namespace std;LL dp[21][70];void Init(){ memset(dp,0,sizeof(dp)); dp[0][0]=1ll;... 阅读全文
posted @ 2015-03-26 11:12 chenjunjie1994 阅读(75) 评论(0) 推荐(0)
摘要: DIJK,最短路,建两个图就好了。#include #include #include #include #include #include using namespace std;const int N = 205;const int inf = 0x3f3f3f3f; int n, m, D1,... 阅读全文
posted @ 2015-03-26 10:41 chenjunjie1994 阅读(122) 评论(0) 推荐(0)
摘要: 很简单的排序题而已。#include #include #include #include using namespace std;const int M=500005;struct Matter{ int bgn,en; bool operator en){ ans+=(Ma[i].bgn-... 阅读全文
posted @ 2015-03-26 10:37 chenjunjie1994 阅读(121) 评论(0) 推荐(0)
摘要: 祼的完全背包问题#include #include #include #include #define LL __int64using namespace std;LL dp[100005];struct Food{ int a,b;}fd[105];int main(){ int n,m; whi... 阅读全文
posted @ 2015-03-26 10:09 chenjunjie1994 阅读(111) 评论(0) 推荐(0)