上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 71 下一页
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4293这题单拉出来写篇吧 确实不错的一题将每个人说的话 转化一下 可以算出它处在哪个段中 题目就转换成了求不相交的最大段数 注意区间相同的情况 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 struct node 8 { 9 int l,r;10 }p[510];11 int dp[510],w[510][510];12 bool cmp(node a,node b)13 {14 ... 阅读全文
posted @ 2013-08-10 19:31 _雨 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 记次CF吧 1题。。。B题。。因为循环的i没设成long long 却参与了运算 结果就悲剧了 一直交 一直挂 。。上题A 水。。 第一次少了个空格还。。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define LL long long 8 LL x,y; 9 int main()10 {11 int i,j,k,n,m;12 cin>>x>>y;13 if((x0)||(x>0&&y0)25 cout 2 #include 3 阅读全文
posted @ 2013-08-10 01:55 _雨 阅读(350) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4655先以最大的来算为 N*所有的排列数 再减掉重复的 重复的计算方法:取相邻的两个数的最小值再与它前面的组合数和后面的组合数相乘注意负值 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define LL long long 8 #define N 1000100 9 #define mod 100000000710 LL s1[N],s2[N],a[N],b[N];11 int main(). 阅读全文
posted @ 2013-08-09 10:30 _雨 阅读(173) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4662I+3*U模6为2或4的都可以 一个U相当于3个I 而I只能1-》2-》4-》8。。如此变换 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 char s[100010]; 7 int main() 8 { 9 int i,n;10 cin>>n;11 while(n--)12 {13 cin>>s;int a=0,b=0;14 int k = st... 阅读全文
posted @ 2013-08-09 09:19 _雨 阅读(191) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4648求连续的一段和对m取余为0 若s[j]和s[i]对M的余数都相同 则相见就满足要求 找个最长的 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define LL long long 8 #define N 100010 9 #define INF 0xfffffff10 LL s[N];11 int a[N],d1[N],d2[N];12 int main()13 {14 int... 阅读全文
posted @ 2013-08-07 09:18 _雨 阅读(198) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4647很扯的一题 将每条边的一半权值分给它所连的两个结点 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 double a[100010]; 8 int main() 9 {10 int i,j,n,m,u,v;11 while(cin>>n>>m)12 {13 for(i = 1; i >a[i];15 double s;16 ... 阅读全文
posted @ 2013-08-07 09:16 _雨 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 补补弱项 全面发展。。从最基础来sdut1299最长上升子序 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int dp[1100]; 8 int a[1100]; 9 int main()10 {11 int i,j,k,n;12 cin>>n;13 for(i =1; i >a[i];16 dp[i] = 1;17 }18 for(i = 1; i a[j])21 {22 dp[i] = max(... 阅读全文
posted @ 2013-08-05 10:56 _雨 阅读(247) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1501搜了下记忆化搜索是嘛 然后就看到这个题了 不过一不小心看到代码了 代码又那么短 一不小心给记住了 然后看了题也没怎么想这个题比较简单把 也没看出哪里记忆化了 感觉扫了一遍 因为s是s1和s2的和 所以对于s里面的字符要么是s1里的要么是s2里的 若都有 分两种情况去搜 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 char s1[210],s2[210],s[500]; 8 int a[2. 阅读全文
posted @ 2013-08-04 13:45 _雨 阅读(240) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4639统计连续he的数量恰为斐波序列 不同块进行相乘 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define mod 10007 7 using namespace std; 8 char ss[11000]; 9 int f[11000];10 int main()11 {12 int t,i,k,kk=0;13 cin>>t;14 f[1] = 1;f[2] = 2;15 for(i = 3; i ... 阅读全文
posted @ 2013-08-04 12:38 _雨 阅读(174) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4638求某一区间所包含的连续的段 对于乱序的数 到了i这个数所包含的段数 首先把这个数看作单独的段 再看一下前面是否出现了它的朋友 若出现了就说明前面已经加过这样单独的段了 就把前面的更新掉-1 这样始终保证一个段的最后一个值记录着这是第几个段 从左到右扫描一遍 离线处理后 这样用树状数组或者线段树进行区间求和就可以了 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define N 100010 7 using namespace std. 阅读全文
posted @ 2013-08-02 12:28 _雨 阅读(230) 评论(0) 推荐(0) 编辑
上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 71 下一页