开始按照顺序刷刷以前的CF。

  1. #include <map>
  2. #include <set>
  3. #include <list>
  4. #include <cmath>
  5. #include <ctime>
  6. #include <deque>
  7. #include <stack>
  8. #include <queue>
  9. #include <cctype>
  10. #include <cstdio>
  11. #include <string>
  12. #include <vector>
  13. #include <climits>
  14. #include <cstdlib>
  15. #include <cstring>
  16. #include <iostream>
  17. #include <algorithm>
  18. #define LL long long
  19. #define PI 3.1415926535897932626
  20. using namespace std;
  21. int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
  22. int a[],d;
  23. int main()
  24. {
  25. while (cin>>a[]>>a[]>>a[]>>a[]>>d)
  26. {
  27. int ans = ;
  28. for (int i = ; i <= d; i++)
  29. {
  30. for (int j = ; j < ; j++)
  31. if (i % a[j] == )
  32. {
  33. ans ++;
  34. break;
  35. }
  36. }
  37. cout<<ans<<endl;
  38. }
  39. return ;
  40. }

B贡献无数发WA。注意相遇的条件 直接double处理就可以。一直以为按照相应直接直接跳跃相应距离 直接int处理

  1. #include <map>
  2. #include <set>
  3. #include <list>
  4. #include <cmath>
  5. #include <ctime>
  6. #include <deque>
  7. #include <stack>
  8. #include <queue>
  9. #include <cctype>
  10. #include <cstdio>
  11. #include <string>
  12. #include <vector>
  13. #include <climits>
  14. #include <cstdlib>
  15. #include <cstring>
  16. #include <iostream>
  17. #include <algorithm>
  18. #define LL long long
  19. #define PI 3.1415926535897932626
  20. using namespace std;
  21. int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
  22. int vp,vd,t,f,c;
  23. int pos[];
  24. int main()
  25. {
  26. while (cin>>vp>>vd>>t>>f>>c)
  27. {
  28. if (vp >= vd) {puts("");continue;}
  29. int thev = vd - vp;
  30. double pospri = vp * t;int ans = ;
  31. while (pospri < c)
  32. {
  33. double ti = pospri / (double)thev;
  34. if ((double) vd * ti >= c) break;
  35. ans ++;
  36. pospri = pospri + f * vp +(double) * ti * vp;
  37. // printf("%d\n",pospri);
  38. if (pospri >= c) break;
  39. }
  40. cout <<ans <<endl;
  41. }
  42. return ;
  43. }

C 坑点比较多。注意b等于0的情况

  1. #include <map>
  2. #include <set>
  3. #include <list>
  4. #include <cmath>
  5. #include <ctime>
  6. #include <deque>
  7. #include <stack>
  8. #include <queue>
  9. #include <cctype>
  10. #include <cstdio>
  11. #include <string>
  12. #include <vector>
  13. #include <climits>
  14. #include <cstdlib>
  15. #include <cstring>
  16. #include <iostream>
  17. #include <algorithm>
  18. #define LL long long
  19. #define PI 3.1415926535897932626
  20. using namespace std;
  21. int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
  22. int n,a,b;
  23. int num[];
  24. int main()
  25. {
  26. while (cin >> n >> a >> b)
  27. {
  28. if (a > n || b > n){ puts("-1");continue;}
  29. if (a > && b == )
  30. {
  31. if (n - a < ) {puts("-1");continue;}
  32. else
  33. {
  34. printf("1 1 ");
  35. for (int i = ,k = ,j = ; j <= n && i <= a ; k++,i++) printf("%d ",k);
  36. for (int i = a + ; i <= n; i++) printf("%d ",a + );
  37. puts("");
  38. }
  39. continue;
  40. }
  41. for (int i = ; i < ; i++) num[i] = ;
  42. int cas = ;
  43. int sum = ;
  44. for (int i = ; i <= b + ; i++)
  45. {
  46. num[i] = sum + cas;
  47. sum += num[i];
  48. }
  49. cas = ;
  50. for (int i = b + ; i <= a + b + ;i ++)
  51. {
  52. num[i] = num[i - ] + cas;
  53. }
  54. for (int i = ; i <= n; i++)
  55. if (i == ) cout << num[i];
  56. else cout << ' ' << num[i];
  57. puts("");
  58. }
  59. return ;
  60. }

D DP

  1. #include <map>
  2. #include <set>
  3. #include <list>
  4. #include <cmath>
  5. #include <ctime>
  6. #include <deque>
  7. #include <stack>
  8. #include <queue>
  9. #include <cctype>
  10. #include <cstdio>
  11. #include <string>
  12. #include <vector>
  13. #include <climits>
  14. #include <cstdlib>
  15. #include <cstring>
  16. #include <iostream>
  17. #include <algorithm>
  18. #define LL long long
  19. #define PI 3.1415926535897932626
  20. using namespace std;
  21. int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
  22. int w,b;
  23. double dp[][];
  24. void init()
  25. {
  26. for (int i = ; i < ; i++)
  27. {
  28. dp[i][] = 1.0;
  29. dp[][i] = 0.0;
  30. }
  31. for (int w = ; w < ; w++)
  32. for (int b = ; b < ; b++)
  33. {
  34. dp[w][b] += 1.0 * w / (w + b);
  35. if (b >= )
  36. dp[w][b] += dp[w][b - ] * 1.0 * b / (w + b) * 1.0 * (b - ) / (w + b - ) * 1.0 * (b - ) / (w + b - );
  37. if (b >= )
  38. dp[w][b] += dp[w - ][b - ] * 1.0 * b / (w + b) * 1.0 * (b - ) / (w + b - ) * w / (w + b - );
  39. }
  40. }
  41. int main()
  42. {
  43. init();
  44. while (scanf("%d%d",&w,&b) != EOF)
  45. printf("%.9lf\n",dp[w][b]);
  46. return ;
  47. }

E DP预处理+DP

  1. #include <map>
  2. #include <set>
  3. #include <list>
  4. #include <cmath>
  5. #include <ctime>
  6. #include <deque>
  7. #include <stack>
  8. #include <queue>
  9. #include <cctype>
  10. #include <cstdio>
  11. #include <string>
  12. #include <vector>
  13. #include <climits>
  14. #include <cstdlib>
  15. #include <cstring>
  16. #include <iostream>
  17. #include <algorithm>
  18. #define LL long long
  19. #define PI 3.1415926535897932626
  20. using namespace std;
  21. int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
  22. #define MAXN 110
  23. #define MAXD 10010
  24. int sum[MAXN][MAXD],dp[MAXN][MAXD],res[MAXN][MAXD];
  25. int N,M;
  26. int num[MAXN];
  27. int main()
  28. {
  29. while (scanf("%d%d",&N,&M) != EOF)
  30. {
  31. memset(dp,,sizeof(dp));
  32. memset(res,,sizeof(res));
  33. for (int i = ; i <= N; i++)
  34. {
  35. scanf("%d",&num[i]);
  36. sum[i][] = ;
  37. for (int j = ; j <= num[i];j++)
  38. {
  39. int tmp;
  40. scanf("%d",&tmp);
  41. sum[i][j] = sum[i][j - ] + tmp;
  42. }
  43. res[i][] = ;
  44. for (int j = ; j <= num[i]; j++)
  45. for (int k = ; k <= j; k++)
  46. res[i][j] = max(res[i][j],sum[i][k] + sum[i][num[i]] - sum[i][num[i] - (j - k)]);
  47. }
  48. for (int i = ; i <= N; i++)
  49. for (int j = ; j <= M; j++)
  50. for (int k = ; k <= num[i] && k <= j; k++)
  51. dp[i][j] = max(dp[i][j],max(dp[i - ][j],dp[i - ][j - k] + res[i][k]));
  52. printf("%d\n",dp[N][M]);
  53. }
  54. return ;
  55. }

Codeforces #105 DIV2 ABCDE的更多相关文章

  1. codeforces#518 Div2 ABCDE

    A---Birthday http://codeforces.com/contest/1068/problem/A 题意: 有n种硬币,m个人.m个人要给Ivan送硬币,每个人送的硬币都要互不相同但数 ...

  2. Codeforces #180 div2 C Parity Game

    // Codeforces #180 div2 C Parity Game // // 这个问题的意思被摄物体没有解释 // // 这个主题是如此的狠一点(对我来说,),不多说了这 // // 解决问 ...

  3. Codeforces #541 (Div2) - E. String Multiplication(动态规划)

    Problem   Codeforces #541 (Div2) - E. String Multiplication Time Limit: 2000 mSec Problem Descriptio ...

  4. Codeforces #541 (Div2) - F. Asya And Kittens(并查集+链表)

    Problem   Codeforces #541 (Div2) - F. Asya And Kittens Time Limit: 2000 mSec Problem Description Inp ...

  5. Codeforces #541 (Div2) - D. Gourmet choice(拓扑排序+并查集)

    Problem   Codeforces #541 (Div2) - D. Gourmet choice Time Limit: 2000 mSec Problem Description Input ...

  6. Codeforces #548 (Div2) - D.Steps to One(概率dp+数论)

    Problem   Codeforces #548 (Div2) - D.Steps to One Time Limit: 2000 mSec Problem Description Input Th ...

  7. 【Codeforces #312 div2 A】Lala Land and Apple Trees

    # [Codeforces #312 div2 A]Lala Land and Apple Trees 首先,此题的大意是在一条坐标轴上,有\(n\)个点,每个点的权值为\(a_{i}\),第一次从原 ...

  8. Codeforces #263 div2 解题报告

    比赛链接:http://codeforces.com/contest/462 这次比赛的时候,刚刚注冊的时候非常想好好的做一下,可是网上喝了个小酒之后.也就迷迷糊糊地看了题目,做了几题.一觉醒来发现r ...

  9. codeforces #round363 div2.C-Vacations (DP)

    题目链接:http://codeforces.com/contest/699/problem/C dp[i][j]表示第i天做事情j所得到最小的假期,j=0,1,2. #include<bits ...

随机推荐

  1. 一行代码将两个列表拼接出第三个列表(两个可迭代对象相加产生第三个可迭代对象)--map()方法

    map()方法 map(func, *iterables) --> map object lambda方法: lambda  参数 :返回值 a = map(',7]) print(list(a ...

  2. struct2 命名空间

    转自http://blog.csdn.net/carefree31441/article/details/4857546 使用Struts2,配置一切正常,使用常用tag也正常,但是在使用<s: ...

  3. Hibernate---架构

    Hibernate 架构是分层的,作为数据访问层,你不必知道底层 API .Hibernate 利用数据库以及配置数据来为应用程序提供持续性服务(以及持续性对象). 下面是一个非常高水平的 Hiber ...

  4. 抽象类的作用之一:sdk 传递你需要的参数

    抽象类可以干什么?抽象类可以让别人必须做一件事情,比如实现一个方法. 那它有什么作用呢? 我开始也不知道啊,后来慢慢的知道了,在开发中,我知道了它是干什么的,怎么用的.比如你要写一个sdk给别人用.但 ...

  5. redis系列文章目录

    redis系列文章目录 使用spring-data-redis实现incr自增 Redis 利用Hash存储节约内存 Redis学习笔记(九)redis实现时时直播列表缓存,支持分页[热点数据存储] ...

  6. python学习笔记十七:base64及md5编码

    一.Python Base64编码 Python中进行Base64编码和解码要用base64模块,代码示例: #-*- coding: utf-8 -*- import base64 str = 'c ...

  7. mongodb导入json文件(WINDOWS)

    mongodb导入json格式的文件的命令是mongoimport: 在下面的这个例子中,使用mongoimport命令将文件pi.json中的内容导入loacal数据库的pi集合中. 打开CMD,进 ...

  8. [转]unity之LOD

    LOD技术有点类似于Mipmap技术,不同的是,LOD是对模型建立了一个模型金字塔,根据摄像机距离对象的远近,选择使用不同精度的模型. 它的好处是可以在适当的时候大量减少需要绘制的顶点数目. 它的缺点 ...

  9. [转载]kd tree

    [本文转自]http://www.cnblogs.com/eyeszjwang/articles/2429382.html k-d树(k-dimensional树的简称),是一种分割k维数据空间的数据 ...

  10. HDU 4725 The Shortest Path in Nya Graph( 建图 + 最短路 )

    主要是建图,建好图之后跑一边dijkstra即可. 一共3N个点,1~N是原图中的点1~N,然后把每层x拆成两个点(N+x)[用于连指向x层的边]和(N+N+x)[用于连从x层指出的边]. 相邻层节点 ...