期望得分:100+100+100=300

实际得分:72+12+0=84

T1  [CQOI2009]中位数图

令c[i]表示前i个数中,比d大的数与比d小的数的差,那么如果c[l]=c[r],则[l+1,r]满足条件

#include<cstdio>
#include<iostream>
using namespace std;
const int N=1e7;
int c[N*],g[N];
void read(int &x)
{
x=; char c=getchar();
while(!isdigit(c)) c=getchar();
while(isdigit(c)) { x=x*+c-''; c=getchar();}
}
int main()
{ int n,d,x,now=,pos;
long long ans=;
bool ok=false;
read(n); read(d);
c[n]=;
for(int i=;i<=n;i++)
{
read(x);
if(x<d) now--;
else if(x>d) now++;
if(x==d) ok=true,pos=i;
if(!ok) c[now+n]++;
else g[i]=now;
}
for(int i=pos;i<=n;i++) ans+=c[g[i]+n];
printf("%lld",ans);
}

T2  #515. 「LibreOJ β Round #2」贪心只能过样例

dp[i][j] 表示到第i个数,能否凑出j

枚举第i个数能填的数v

dp[i][j]=dp[i-1][j-v*v]

bitset优化

#include<bitset>
#include<cstdio>
using namespace std;
const int MAXN=;
bitset<MAXN>b[];
int main()
{
//freopen("kinds.in","r",stdin);
//freopen("kinds.out","w",stdout);
int n,l,r;
scanf("%d",&n);
b[]^=;
for(int i=;i<=n;i++)
{
scanf("%d%d",&l,&r);
for(int j=l;j<=r;j++) b[i]|=b[i-]<<(j*j);
}
printf("%d",b[n].count());
}

T3

按截距排序之后区间DP

#include<cmath>
#include<cstdio>
#include<iostream>
#include<algorithm>
#define N 2001
using namespace std;
void read(int &x)
{
x=0; int f=1; char c=getchar();
while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
while(isdigit(c)) { x=x*10+c-'0'; c=getchar();}
x*=f;
}
struct node
{
int x,y,v,c,cnt;
double b;
}e[N];
double k;
const double pi=3.1415926;
const double eps=1e-12;
double dp[N];
double prec[N],prev[N];
int s[N];
double cal(int i)
{
return e[i].y-k*e[i].x;
}
bool cmp(node p,node q)
{
return p.b<q.b;
}
int main()
{
//freopen("yuuka.in","r",stdin);
//freopen("yuuka.out","w",stdout);
int n,kk;
read(n);
for(int i=1;i<=n;i++) read(e[i].x),read(e[i].y),read(e[i].v),read(e[i].c);
read(kk);
if(kk)
{
k=tan(pi*kk/180);
for(int i=1;i<=n;i++) e[i].b=cal(i),e[i].cnt=1;
}
else for(int i=1;i<=n;i++) e[i].b=e[i].y,e[i].cnt=1;
sort(e+1,e+n+1,cmp);
int tot=1;
for(int i=2;i<=n;i++)
if(fabs(e[i].b-e[i-1].b)<eps) e[tot].v+=e[i].v,e[tot].c+=e[i].c,e[tot].cnt+=e[i].cnt;
else e[++tot]=e[i];
for(int i=1;i<=tot;i++) s[i]=s[i-1]+e[i].cnt,prec[i]=prec[i-1]+e[i].c,prev[i]=prev[i-1]+e[i].v;
dp[1]=e[1].v*e[1].c*1.0/e[1].cnt;
for(int i=2;i<=tot;i++)
for(int j=0;j<i;j++)
dp[i]=max(dp[i],dp[j]+(prec[i]-prec[j])*(prev[i]-prev[j])*1.0/(s[i]-s[j]));
printf("%.3lf",dp[tot]);
// for(int i=1;i<=tot;i++) printf("%.3lf\n",dp[i]);
}

  

NOIP模拟5的更多相关文章

  1. NOIP模拟赛20161022

    NOIP模拟赛2016-10-22 题目名 东风谷早苗 西行寺幽幽子 琪露诺 上白泽慧音 源文件 robot.cpp/c/pas spring.cpp/c/pas iceroad.cpp/c/pas ...

  2. contesthunter暑假NOIP模拟赛第一场题解

    contesthunter暑假NOIP模拟赛#1题解: 第一题:杯具大派送 水题.枚举A,B的公约数即可. #include <algorithm> #include <cmath& ...

  3. NOIP模拟赛 by hzwer

    2015年10月04日NOIP模拟赛 by hzwer    (这是小奇=> 小奇挖矿2(mining) [题目背景] 小奇飞船的钻头开启了无限耐久+精准采集模式!这次它要将原矿运到泛光之源的矿 ...

  4. 大家AK杯 灰天飞雁NOIP模拟赛题解/数据/标程

    数据 http://files.cnblogs.com/htfy/data.zip 简要题解 桌球碰撞 纯模拟,注意一开始就在袋口和v=0的情况.v和坐标可以是小数.为保险起见最好用extended/ ...

  5. 队爷的讲学计划 CH Round #59 - OrzCC杯NOIP模拟赛day1

    题目:http://ch.ezoj.tk/contest/CH%20Round%20%2359%20-%20OrzCC杯NOIP模拟赛day1/队爷的讲学计划 题解:刚开始理解题意理解了好半天,然后发 ...

  6. 队爷的Au Plan CH Round #59 - OrzCC杯NOIP模拟赛day1

    题目:http://ch.ezoj.tk/contest/CH%20Round%20%2359%20-%20OrzCC杯NOIP模拟赛day1/队爷的Au%20Plan 题解:看了题之后觉得肯定是DP ...

  7. 队爷的新书 CH Round #59 - OrzCC杯NOIP模拟赛day1

    题目:http://ch.ezoj.tk/contest/CH%20Round%20%2359%20-%20OrzCC杯NOIP模拟赛day1/队爷的新书 题解:看到这题就想到了 poetize 的封 ...

  8. CH Round #58 - OrzCC杯noip模拟赛day2

    A:颜色问题 题目:http://ch.ezoj.tk/contest/CH%20Round%20%2358%20-%20OrzCC杯noip模拟赛day2/颜色问题 题解:算一下每个仆人到它的目的地 ...

  9. CH Round #52 - Thinking Bear #1 (NOIP模拟赛)

    A.拆地毯 题目:http://www.contesthunter.org/contest/CH%20Round%20%2352%20-%20Thinking%20Bear%20%231%20(NOI ...

  10. CH Round #49 - Streaming #4 (NOIP模拟赛Day2)

    A.二叉树的的根 题目:http://www.contesthunter.org/contest/CH%20Round%20%2349%20-%20Streaming%20%234%20(NOIP 模 ...

随机推荐

  1. Alpha阶段事后诸葛亮会议记录

    此作业要求参见:https://edu.cnblogs.com/campus/nenu/2018fall/homework/2324 组名:可以低头,但没必要 组长:付佳 组员:张俊余  李文涛  孙 ...

  2. mininet实验 可视化界面形成拓扑

    参考博客一 参考博客二 实验目的 mininet中内置了一个mininet可视化工具:miniedit.miniedit在mininet/mininet/examples目录下提供miniedit.p ...

  3. 事后诸葛亮--Alpha版本总结

    目录 设想和目标 计划 资源 变更管理 设计/实现 测试/发布 团队的角色,管理,合作 总结: 本小组和其他组的评分 分工和贡献分 全组讨论的照片 问题 第一组提问回答:爸爸饿了队 第二组提问回答:拖 ...

  4. Jquery mobile div常用属性

    组件 页面 jQuery Mobile 应用了 HTML5 标准的特性,在结构化的页面中完整的页面结构分为 header. content.footer 这三个主要区域. 在 body 中插入内容块: ...

  5. oracle 关于表数据delete 后如何恢复

    今天在PL/SQL中操作不小心删掉了某个表的部分数据,这可吓坏了本猿:于是悄悄的打开电脑,赶紧找度娘帮忙.经过度娘的小爬虫帮助,几分钟就把数据恢复了. 那么表数据delete掉后怎么恢复呢? 用fla ...

  6. 大型Java web项目分布式架构演进-分布式部署

    http://blog.csdn.net/binyao02123202/article/details/32340283/ 知乎相关文章https://www.zhihu.com/question/2 ...

  7. Hibernate 中一级缓存和快照区的理解

    刚刚开始的时候觉得这个快照区很难理解,在网上看了很多博客之后,开始明白了.我是结合 ADO.NET 理解的,在ADO.NET 中有一个类, 叫 SqlCommandBuilder,在我看来,他就是 A ...

  8. python的N个小功能(高斯模糊原理及实践)

    原理: 二维高斯函数 1)         为了计算权重矩阵,需要设定σ的值.假定σ=1.5,则模糊半径为1的权重矩阵如下: 2)         这9个点的权重总和等于0.4787147,如果只计算 ...

  9. 【明哥报错簿】可以访问jsp但是访问不到controller

    此工程wms-web-enterprise启动之后,jsp页面可以访问,但是进不了controller.后来发现wms-consumer无法打包编译,在仓库m2里面发现此consumer.jar包为完 ...

  10. MariaDB插入中文出现???情况

    本来打算创建一个测试表进行一个简单的实验,发现创建完python_test表后插入数据后,select发现所有中文都变成问号了,这一看就是出现了乱码 MariaDB [lhc]> create ...