题目链接

题意: 给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. 用gd库画矩形和椭圆

    画矩形:bool imagerectangle ( resource $image画布资源 , int $x1左上角的坐标 , int $y1 , int $x2 右下角坐标, int $y2 , i ...

  2. java 反射机制探究

    一 反射机制操作类的成员变量 二 操作类的方法 三 利用反射实例化类 四 利用反射访问一个类的私有成员  五 利用反射覆盖数据对象的toString 方法

  3. OC1_汉字拼音转换 练习

    // // WordManager.h // OC1_汉字拼音转换 // // Created by zhangxueming on 15/4/27. // Copyright (c) 2015年 z ...

  4. 【开发】Dialog 对话框

    提示:Dialog 继承自 Panel,有大量的方法在 Panel 中已被定义,可以复用. Dialog API:http://www.jeasyui.net/plugins/181.html Pan ...

  5. Action Filters for ASP.NET MVC

    本文主要介绍ASP.NET MVC中的Action Filters,并通过举例来呈现其实际应用. Action Filters 可以作为一个应用,作用到controller action (或整个co ...

  6. 再也不要看到Eclipse万恶的arg0,arg1提示

    不知道大家跟我是否一下,遇到arg的提示. @Override public void onDateChanged(DatePicker arg0, int arg1, int arg2, int a ...

  7. java培训(5-8节课)

    面向对象: 1.利用面向对象的语法,实现代码的拆分(数据存储:对象的传值). 2.利用面向对象的语法,实现程序的结构处理(继承,多态,接口,抽象类). 3.用面向对象的编程方法,理解实现程序开发的框架 ...

  8. [PR & ML 6] [Introduction] Information Theory

  9. How to: Change icon in Inno Setup

    1. Change the installer executable icon or the icon showed in Start Menu folder Using SetupIconFile ...

  10. SharePoint Client Add Folder,file to Library

    public void UploadDocument(string siteURL, string documentListName, string documentListURL, string d ...