开始按照顺序刷刷以前的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. idea debug启动项目慢或者启动不了

    使用debug无法启动项目但是使用run就可以启动程序,而且启动比以前的debug模式快的多 原因: 启动不了的原因是在项目中的方法上打了断点,导致项目无法继续编译 取消方法断点就可以了 在idea官 ...

  2. HyperLedger Fabric 1.4 比特币历史(1.1)

    比特币是一种数字货币,也是一种创新思维,把人们带入到一个无中心化.完全可信任.安全可靠的全新思维领域:一个叫“中本聪”的人或组织,使我们思维产生化学反应,他在2008年10月31日发表了比特币白皮书& ...

  3. CONDENSE命令により、文字列から冗長スペースが削除

    CONDENSE 命令により.文字列から冗長スペースが削除されます. CONDENSE c [NO-GAPS]. この命令により.項目 c に先行空白が含まれる場合は削除され.その他の空白列がある場合 ...

  4. python读取文件

    请参考:http://www.cnblogs.com/sysuoyj/archive/2012/03/14/2395789.html

  5. 模块hashlib和logging

    Python的hashlib提供了常见的摘要算法MD5. 我们以常见的摘要算法MD5为例,计算出一个字符串的MD5值: import hashlib md5=hashlib.md5() md5.upd ...

  6. 减少Android staido 占用C 盘

    1.gradle 更换文件夹: 设置GRADLE_USER_HOME环境变量 在/etc/profile或~/.bash_profile增加如下: export GRADLE_USER_HOME=D: ...

  7. CentOS 7 安装Oracle 11gR2

    概述 Oracle 在Linux和window上的安装不太一样,公司又是Linux系统上的Oracle,实在没辙,研究下Linux下Oracle的使用,oracle默认不支持CentOS系统安装,所以 ...

  8. Erlang中常用的类型转换[转]

    转自: http://blog.sina.com.cn/s/blog_53a5047b01018yqv.html 例子 结果 atom_to_list(hello). "hello" ...

  9. Httpclient httpdelete 参数

    Httpclient 中常用的请求有2个,HttpPost 和 HttpGet,今天在对某个网站进行分析的时候,突然发现用到了 HttpDelete,并且传参 是 Json. 1.一般 HttpPos ...

  10. 如何写一套下拉刷新的控件?《MJRefresh原理浅析》(附Demo下载地址)

    相信大家有很多人在做项目的时候都在使用MJRefresh 控件来实现下拉刷新的功能: MJRefresh经过不断的重构与更新迭代,现在不管是功能上还是代码结构上都是相当不错的,都是很值我们去学习的. ...