题目链接

题意: 给n个点 每个点的坐标 x y 出现的时间t 射中的概率

从i点到j点的时间为它们的距离.

求射中个数的最大期望

很水的dp  坑点就是要用LL

 #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <cmath>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
#include <queue>
#include <stack>
#include <vector>
#include <deque>
#include <set>
#include <map>
typedef long long LL;
typedef long double LD;
#define pi acos(-1.0)
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
typedef pair<int, int> PI;
typedef pair<int, PI> PP;
#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
//#pragma comment(linker, "/STACK:1024000000,1024000000")
//LL quick(LL a, LL b){LL ans=1;while(b){if(b & 1)ans*=a;a=a*a;b>>=1;}return ans;}
//inline int read(){char ch=' ';int ans=0;while(ch<'0' || ch>'9')ch=getchar();while(ch<='9' && ch>='0'){ans=ans*10+ch-'0';ch=getchar();}return ans;}
//inline void print(LL x){printf(LLD, x);puts("");}
//inline void read(double &x){char c = getchar();while(c < '0') c = getchar();x = c - '0'; c = getchar();while(c >= '0'){x = x * 10 + (c - '0'); c = getchar();}} const double eps=1e-;
struct node
{
LL x, y, t;
double p;
}a[];
double dp[];
bool cmp(node a, node b)
{
return a.t<b.t;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
int n;
while(~scanf("%d", &n))
{
for(int i=;i<n;i++)
{
scanf(LLD, &a[i].x);
scanf(LLD, &a[i].y);
scanf(LLD, &a[i].t);
scanf("%lf", &a[i].p);
}
sort(a, a+n, cmp);
memset(dp, , sizeof(dp));
for(int i=;i<n;i++)
{
dp[i]=a[i].p;
for(int j=;j<i;j++)
if((a[j].x-a[i].x)*(a[j].x-a[i].x)+(a[j].y-a[i].y)*(a[j].y-a[i].y)<=(a[j].t-a[i].t)*(a[j].t-a[i].t)+eps)
dp[i]=max(dp[i], a[i].p+dp[j]);
}
double ans=;
for(int i=;i<n;i++)
ans=max(ans, dp[i]);
printf("%.10lf\n", ans);
}
return ;
}

Codeforces 30C

[dp]Codeforces30C Shooting Gallery的更多相关文章

  1. 【20.00%】【codeforces 44G】Shooting Gallery

    time limit per test5 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  2. 【16.50%】【CF 44G】Shooting Gallery

    time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standa ...

  3. CodeForces 30C Shooting Gallery 简单dp

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/qq574857122/article/details/36944227 题目链接:点击打开链接 给定 ...

  4. Gym - 101670F Shooting Gallery(CTU Open Contest 2017 区间dp)

    题目&题意:(有点难读...) 给出一个数字序列,找出一个区间,当删除这个区间中的两个相同的数字后,只保留这两个数字之间的序列,然后继续删除相同的数字,问最多可以实行多少次删除操作. 例如: ...

  5. CTU OPEN 2017 Shooting Gallery /// 区间DP

    题目大意: 给定n 给定n个数 选定一个区间留下其他消去 要求区间两端的两个数一样 若成功留下一个区间 则在选定区间的基础上 继续进行上述操作 直到无法再选出这样的区间 求最多操作数 按区间长度由短到 ...

  6. CF dp 题(1500-2000难度)

    前言 从后往前刷 update 新增 \(\text{\color{red}{Mark}}\) 标记功能,有一定难度的题标记为 \(\text{\color{red}{红}}\) 色. 题单 (刷过的 ...

  7. mark一下咕掉的题目

    蒟蒻才普及组呀~ 大佬别D我 等集中补一下 CF980F:咋说捏,我觉得要联赛了做这题有点浪费时间,等想颓废了再来写写叭qwq 215E/279D/288E/331C3/431D/433E/750G/ ...

  8. [Unity3D]Unity资料大全免费分享

     都是网上找的连七八糟的资料了,整理好分享的,有学习资料,视频,源码,插件……等等 东西比较多,不是所有的都是你需要的,可以按  ctrl+F 来搜索你要的东西,如果有广告,不用理会,关掉就可以了,如 ...

  9. Android -- ImageSwitch和Gallery 混合使用

    1. 实现效果

随机推荐

  1. java面板

    import java.awt.Color; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JLab ...

  2. C#学习笔记1:正则表达式和数据库连接

    1.using System.Text.RegularExpressions; 只有导入该命名空间,才能引入Regex对象,IsMatch是Regex中的一个方法,作用是来判断(输入)内容是否满足正则 ...

  3. HttpClient的使用

    HttpClient的使用 一.简介 HttpClient是Apache Jakarta Common下的子项目,用来提供高效的.最新的.功能丰富的支持HTTP协议的客户端编程工具包,并且它支持HTT ...

  4. LeetCode初体验—twoSum

    今天注册了大名鼎鼎的LeetCode,做了一道最简单的算法题目: Given an array of integers, return indices of the two numbers such ...

  5. jsp页面在IE8下文本模式自动为“杂项(Quirks)”导致页面显示错位

    最近在修改网站的响应式的页面时,由于都是套样式页面,修改过程都是粘贴复制,导致了一些细节问题在IE8下暴露出来: 遇到的问题就是在在Chrome,火狐页面都正常,唯独在IE8下页面样式显示乱样了,但是 ...

  6. ###Canny边缘检测算子

    开源中国. #@date: 2014-06-20 #@author: gerui #@email: forgerui@gmail.com 一.一阶微分边缘算子 1. 一阶微分边缘检测算子也称梯度边缘算 ...

  7. 第五篇、C_二叉搜索树

    1.二叉树的查找功能的时间复杂度比链表的好 2.删除节点的稍微复杂点 >没有节点,直接删除 >只有左节点(或者右节点),直接用该节点的左节点(或者右节点)替代要删除的节点 >有左节点 ...

  8. QT 常用设置

    博文都写在了云笔记里面了,见谅,不想维护两个版本. QT 常用设置

  9. Nginx+keepalived实现负载均衡

    Nginx的优点是: 1.工作在网络的7层之上,可以针对http应用做一些分流的策略,比如针对域名.目录结构,它的正则规则比HAProxy更为强大和灵活,这也是它目前广泛流行的主要原因之一,Nginx ...

  10. IE专用CSS,最全的CSS hack方式一览

    http://blog.csdn.net/freshlover/article/details/12132801