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

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
int a[],d;
int main()
{
while (cin>>a[]>>a[]>>a[]>>a[]>>d)
{
int ans = ;
for (int i = ; i <= d; i++)
{
for (int j = ; j < ; j++)
if (i % a[j] == )
{
ans ++;
break;
}
}
cout<<ans<<endl;
}
return ;
}

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

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
int vp,vd,t,f,c;
int pos[];
int main()
{
while (cin>>vp>>vd>>t>>f>>c)
{
if (vp >= vd) {puts("");continue;}
int thev = vd - vp;
double pospri = vp * t;int ans = ;
while (pospri < c)
{
double ti = pospri / (double)thev;
if ((double) vd * ti >= c) break;
ans ++;
pospri = pospri + f * vp +(double) * ti * vp;
// printf("%d\n",pospri);
if (pospri >= c) break;
}
cout <<ans <<endl;
}
return ;
}

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

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
int n,a,b;
int num[];
int main()
{
while (cin >> n >> a >> b)
{
if (a > n || b > n){ puts("-1");continue;}
if (a > && b == )
{
if (n - a < ) {puts("-1");continue;}
else
{
printf("1 1 ");
for (int i = ,k = ,j = ; j <= n && i <= a ; k++,i++) printf("%d ",k);
for (int i = a + ; i <= n; i++) printf("%d ",a + );
puts("");
}
continue;
}
for (int i = ; i < ; i++) num[i] = ;
int cas = ;
int sum = ;
for (int i = ; i <= b + ; i++)
{
num[i] = sum + cas;
sum += num[i];
}
cas = ;
for (int i = b + ; i <= a + b + ;i ++)
{
num[i] = num[i - ] + cas;
}
for (int i = ; i <= n; i++)
if (i == ) cout << num[i];
else cout << ' ' << num[i];
puts("");
}
return ;
}

D DP

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
int w,b;
double dp[][];
void init()
{
for (int i = ; i < ; i++)
{
dp[i][] = 1.0;
dp[][i] = 0.0;
}
for (int w = ; w < ; w++)
for (int b = ; b < ; b++)
{
dp[w][b] += 1.0 * w / (w + b);
if (b >= )
dp[w][b] += dp[w][b - ] * 1.0 * b / (w + b) * 1.0 * (b - ) / (w + b - ) * 1.0 * (b - ) / (w + b - );
if (b >= )
dp[w][b] += dp[w - ][b - ] * 1.0 * b / (w + b) * 1.0 * (b - ) / (w + b - ) * w / (w + b - );
}
}
int main()
{
init();
while (scanf("%d%d",&w,&b) != EOF)
printf("%.9lf\n",dp[w][b]);
return ;
}

E DP预处理+DP

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
#define MAXN 110
#define MAXD 10010
int sum[MAXN][MAXD],dp[MAXN][MAXD],res[MAXN][MAXD];
int N,M;
int num[MAXN];
int main()
{
while (scanf("%d%d",&N,&M) != EOF)
{
memset(dp,,sizeof(dp));
memset(res,,sizeof(res));
for (int i = ; i <= N; i++)
{
scanf("%d",&num[i]);
sum[i][] = ;
for (int j = ; j <= num[i];j++)
{
int tmp;
scanf("%d",&tmp);
sum[i][j] = sum[i][j - ] + tmp;
}
res[i][] = ;
for (int j = ; j <= num[i]; j++)
for (int k = ; k <= j; k++)
res[i][j] = max(res[i][j],sum[i][k] + sum[i][num[i]] - sum[i][num[i] - (j - k)]);
}
for (int i = ; i <= N; i++)
for (int j = ; j <= M; j++)
for (int k = ; k <= num[i] && k <= j; k++)
dp[i][j] = max(dp[i][j],max(dp[i - ][j],dp[i - ][j - k] + res[i][k]));
printf("%d\n",dp[N][M]);
}
return ;
}

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. mybatis <forEach>标签的使用

    MyBatis<forEach>标签的使用 你可以传递一个 List 实例或者数组作为参数对象传给 MyBatis.当你这么做的时候,MyBatis 会自动将它包装在一个 Map 中,用名 ...

  2. [CodeForces954D]Fight Against Traffic(最短路)

    Description 题目链接 Solution 从起点和终点分别做一次最短路并记录结果 枚举每一条可能的边判断 Code #include <cstdio> #include < ...

  3. 笔记-python-语法-super

    笔记-python-语法-super 1.      super 1.1.    super起源 首先要理解类的继承和多继承,子类有时需要调用父类的方法, 非绑定方法: class C(B): def ...

  4. 初见akka-02:rpc框架

    1.RPC:简单点说,就是多线程之间的通信,我们今天用了scala以及akka 来简单的实现了 rpc框架的一些简单的内容,一脸包括了,心跳,间隔时间, 注册以及一些问题, 模式匹配的一些东西,虽然比 ...

  5. PHP.22-Smart模版

    Smart模版 smarty是一个基于PHP开发的PHP模板引擎.它提供了逻辑与外在内容的分离,简单的讲,目的就是要使PHP程序员同美工分离,使用的程序员改变程序的逻辑内容不会影响到美工的页面设计,美 ...

  6. Centos7 查看Mysql配置文件

    my.cnf是mysql启动时加载的配置文件,一般会放在mysql的安装目录中,用户也可以放在其他目录加载. 安装mysql后,系统中会有多个my.cnf文件,有些是用于测试的. 使用locate m ...

  7. 设置MySQL允许外网访问 费元星 feiyuanxing.com 站长

    1.修改配置文件sudo vim /etc/mysql/my.cnf把bind-address参数的值改成你的内/外网IP或0.0.0.0,或者直接注释掉这行. 2.登录数据库mysql -u roo ...

  8. 剑指Offer - 九度1519 - 合并两个排序的链表

    剑指Offer - 九度1519 - 合并两个排序的链表2013-11-30 22:04 题目描述: 输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则.(hi ...

  9. 剑指Offer - 九度1349 - 数字在排序数组中出现的次数

    剑指Offer - 九度1349 - 数字在排序数组中出现的次数2013-11-23 00:47 题目描述: 统计一个数字在排序数组中出现的次数. 输入: 每个测试案例包括两行: 第一行有1个整数n, ...

  10. FlexGrid布局

    FlexGrid布局: Grid布局时网格大小是固定的,如果想网格大小不同的界面可以使用FlexGrid布局.FlexGrid是更加灵活的Grid布局.FlexGrid布局类是wx.FlexGridS ...