期望得分: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. 20172305 2018-2019-1 《Java软件结构与数据结构》第六周学习总结

    20172305 2018-2019-1 <Java软件结构与数据结构>第六周学习总结 教材学习内容总结 本周内容主要为书第十章内容: 树(一种非线性结构,其中的元素被组织成一个层次结构) ...

  2. POJ2528的另一种解法(线段切割)

    题目:Mayor's posters 原文地址 首先本题题意是:有一面墙,被等分为1QW份,一份的宽度为一个单位宽度.现在往墙上贴N张海报,每张海报的宽度是任意 的,但是必定是单位宽度的整数倍,且&l ...

  3. SSH 框架的心得

    使用SSH框架做完了一个普通网站的前后台项目,成热写点心得,免得以后再入坑.其中使用 Strust2  2.3.33 + Spring 4.3.9 + Hibernate 5.2.10 eclipse ...

  4. Web前端JQuery基础

    JQuery知识汇总 一.关于Jquery简介          jQuery是一个快速.简洁的JavaScript框架,是继Prototype之后又一个优秀的JavaScript代码库(或JavaS ...

  5. 弱网络模拟测试工具---易测app

    易测功能介绍   易测是一款基于无线客户端研发场景的通用测试工具, 它通过在研发人员的自持机上提供各种辅助能力&标准化的专项测试服务来提升研发质量&效率.   易测app是阿里巴巴做的 ...

  6. static变量的特点 - 只会有一份成员对象

    1.   public class HasStatic{ 2.     private static int x=100; 3.     public static void main(String ...

  7. [BZOJ4027]兔子与樱花

    4027: [HEOI2015]兔子与樱花 Time Limit: 10 Sec  Memory Limit: 256 MB Description 很久很久之前,森林里住着一群兔子.有一天,兔子们突 ...

  8. 【题解】JSOI2011分特产

    没sa可suo的,sui题一道…… #include <bits/stdc++.h> using namespace std; #define maxn 3000 #define mod ...

  9. 使用SetupDI* API列举系统中的设备

    原文链接地址:https://blog.csdn.net/clteng/article/details/801012?utm_source=blogxgwz8 在Windows系统中提供一组有用的函数 ...

  10. python基础(4)

    条件判断和循环 条件判断 计算机之所以能做很多自动化的任务,因为它可以自己做条件判断. 比如,输入用户年龄,根据年龄打印不同的内容,在Python程序中,用if语句实现: age = 20 if ag ...