摘要: 洛谷3382 1 #include<iostream> 2 #include<cstring> 3 #include<cstdlib> 4 #include<cstdio> 5 #include<cmath> 6 #include<algorithm> 7 using namespace std; 阅读全文
posted @ 2017-11-09 11:25 Driver_Lao 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 洛谷3811 先用n!p-2求出n!的乘法逆元 因为有(i-1)!-1=i!-1*i (mod p),于是我们可以O(n)求出i!-1 再用i!-1*(i-1)!=i-1 (mod p)即是答案 1 #include<iostream> 2 #include<cstring> 3 #include< 阅读全文
posted @ 2017-11-09 09:42 Driver_Lao 阅读(391) 评论(0) 推荐(0) 编辑
摘要: 洛谷3370 这题煞笔的吧QAQ......排序去重或者Map都可以 1 #include<cstdio> 2 #include<map> 3 #include<string> 4 using namespace std; 5 map<int, int> dic; 6 int ans=0,n; 7 阅读全文
posted @ 2017-11-09 08:49 Driver_Lao 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 给出1-n的两个排列P1和P2,求它们的最长公共子序列。 洛谷1439 1 #include<cstdio> 2 #include<algorithm> 3 using namespace std; 4 const int maxn=100010; 5 int n,x,ans,tmp,pos[max 阅读全文
posted @ 2017-11-09 08:25 Driver_Lao 阅读(411) 评论(0) 推荐(0) 编辑
摘要: 洛谷3387 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 using namespace std; 5 const int maxn=20010,maxm=200010; 6 int ans,n,m,etot,tot, 阅读全文
posted @ 2017-11-09 08:02 Driver_Lao 阅读(121) 评论(0) 推荐(0) 编辑