A Alien’s Organ
There’s an alien whose name is Marjar. It is an universal solder came from planet Highrich a long time ago.

Marjar is a strange alien. It needs to generate new organs(body parts) to fight. The generated organs will provide power to Marjar and then it will disappear. To fight for problem of moral integrity decay on our earth, it will randomly generate new fighting organs all the time, no matter day or night, no matter rain or shine. Averagely, it will generate λ new fighting organs every day.

Marjar’s fighting story is well known to people on earth. So can you help to calculate the possibility of that Marjar generates no more than N organs in one day?

Input
The first line contains a single integer T (0 ≤ T ≤ 10000), indicating there are T cases in total. Then the following T lines each contains one integer N (1 ≤ N ≤ 100) and one float number λ (1 ≤ λ ≤ 100), which are described in problem statement.
Output
For each case, output the possibility described in problem statement, rounded to 3 decimal points.
Sample Input
3
5 8.000
8 5.000
2 4.910
Sample Output
0.191
0.932
0.132
迫松分布,第一次遇见这中题,还特意上网查了查迫松分布啥意思。。
代码如下:

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define ll long long
using namespace std;int t;
int n;
double f;int main()
{int t;scanf("%d",&t);while(t--){scanf("%d%lf",&n,&f);double sum=1;double ans=0;for(int i=0;i<=n;i++)//题目说是不大于n,所以就是从零到n。0的时候0的阶乘就是1。{if(i==0) {ans+=1;continue;}sum*=f;sum/=(double) i;ans+=sum;}ans*=exp(-f);//迫松分布函数,紧急printf("%.3lf\n",ans);}
}

Happy Programming Contest
In Zhejiang University Programming Contest, a team is called “couple team” if it consists of only two students loving each other. In the contest, the team will get a lovely balloon with unique color for each problem they solved. Since the girl would prefer pink balloon rather than black balloon, each color is assigned a value to measure its attractiveness. Usually, the boy is good at programming while the girl is charming. The boy wishes to solve problems as many as possible. However, the girl cares more about the lovely balloons. Of course, the boy’s primary goal is to make the girl happy rather than win a prize in the contest.

Suppose for each problem, the boy already knows how much time he needs to solve it. Please help him make a plan to solve these problems in strategic order so that he can maximize the total attractiveness value of balloons they get before the contest ends. Under this condition, he wants to solve problems as many as possible. If there are many ways to achieve this goal, he needs to minimize the total penalty time. The penalty time of a problem is equal to the submission time of the correct solution. We assume that the boy is so clever that he always submit the correct solution.

Input
The first line of input is an integer N (N < 50) indicating the number of test cases. For each case, first there is a line containing 2 integers T (T <= 1000) and n (n <= 50) indicating the contest length and the number of problems. The next line contains n integers and the i-th integer ti (ti <= 1000) represents the time needed to solve the ith problem. Finally, there is another line containing n integers and the i-th integer vi (vi <= 1000) represents the attractiveness value of the i-th problem. Time is measured in minutes.

Output
For each case, output a single line containing 3 integers in this order: the total attractiveness value, the number of problems solved, the total penalty time. The 3 integers should be separated by a space.

Sample Input
2
300 10
10 10 10 10 10 10 10 10 10 10
1 2 3 4 5 6 7 8 9 10
300 10
301 301 301 301 301 301 301 301 301 301
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000

Sample Output
55 10 550
0 0 0
dp题目,几乎每一次都有dp题。
这个题第一次看的时候,就觉得有点像01背包,但是不知道怎么弄。由于题目说是在总价值最大的时候,出题数最大,罚时最小。一开始是按价值排的序,样例过了,然后wa了。后来按着时间有小到大排序。就过了。后来想了想,就算是不按着价值排序,在dp的时候,也还是会找到时间最大值的,但是那个时间罚时就不一定了。代码如下

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;const int maxx=1e3+100;
ll dp[4][maxx];
struct node{int w;int val;
}p[maxx];
int sumt,n;bool cmp(const node &a,const node &b)
{return a.w<b.w;
}int main()
{int t;scanf("%d",&t);while(t--){scanf("%d%d",&sumt,&n);memset(dp,0,sizeof(dp));for(int i=0;i<n;i++) scanf("%d",&p[i].w);for(int i=0;i<n;i++) scanf("%d",&p[i].val);sort(p,p+n,cmp);for(int i=0;i<n;i++){for(int j=sumt;j>=0;j--){if(dp[0][j]<dp[0][j-p[i].w]+p[i].val&&j-p[i].w>=0){dp[0][j]=dp[0][j-p[i].w]+p[i].val;dp[1][j]=dp[1][j-p[i].w]+1;dp[2][j]=dp[2][j-p[i].w]+p[i].w;dp[3][j]=dp[3][j-p[i].w]+dp[2][j];}}}printf("%d %d %d\n",dp[0][sumt],dp[1][sumt],dp[3][sumt]);}}

还有两个题是队友做的。代码暂无
努力加油a啊,(o)/~

qdu_ACM集训队3月5号组队训练相关推荐

  1. qdu_ACM3月7号组队训练

    A Second-price Auction Do you know second-price auction? It's very simple but famous. In a second-pr ...

  2. 2018年7月20号暑假训练日记

    今天早上看了一下昨天出现的那个拉格朗日插值的题目,大佬的代码让人头大,不知道具体用什么点插值,于是放弃了那个题目,从网上看了一些插值的题目,有一些特别表面的题目,这样的插值题目倒是跟我们平时数值分析题 ...

  3. 2016CCPC东北地区大学生程序设计竞赛 (2018年8月22日组队训练赛)

    题目链接:http://acm.hdu.edu.cn/search.php?field=problem&key=2016CCPC%B6%AB%B1%B1%B5%D8%C7%F8%B4%F3%D ...

  4. 【OCM第17期开班】第17期11g OCM培训将于7月22号晚20点在腾讯课堂开班,第1场考试免费培训!!!...

    Oracle 11g ocm第17期将于7月22号晚上20点开班,第1场考试免费培训,包过,题库100%覆盖,提供和考试环境一样的练习和模拟环境. Oracle  11g OCM免费上课培训网上报名连 ...

  5. 【2022年华为杯数学建模E题赛后总结加思路详细介绍配代码----10月11号写的总结】

    提示:下文将介绍2022年华为杯数学建模E题赛后总结加思路详细介绍配代码 傻逼队友,傻逼队友,傻逼队友一定要看好人在进行组队,这是劝告. 这里有几点总结进行描述: 第一,图一定要尽量多,对图的解释要多 ...

  6. 【长更】一句话题解(组队训练的俄罗斯题、oj、camp)

      还是太长了,第二次分裂..   标 * 的为有价值的题,标 ^ 的为欺诈题,标 - 的为知识点待填坑,标 ? 的表示看别人是这样做的但是没懂为什么   组队训练的题,如果是队友过的板刷题,题面又很 ...

  7. 4月1-5号在武汉举行第五届全国Revit开发中高级实战训练营

    各建筑设计.施工.咨询.业主.高校等单位:   BIM在工程建设行业的应用越来越广泛和深入,在教育.设计.施工.咨询等方面迅速发展,Revit二次开发人才炽手可热.在BIM快速发展之际,拥有Revit ...

  8. 2008年9月11号,星期四,晴。今天是我博士生涯的第67天,离中秋越来越近了,昨天和太太通电话,得知九江下了很大的雨

    2008年9月11号,星期四,晴. 今天是我博士生涯的第67天,离中秋越来越近了,昨天 和 太太通电话,得知九江下了很大的雨,我说呢,白天还是很热的武汉,晚上的时候凉风习习,可能秋天的脚步是越来越近了 ...

  9. 2017年6月16号课堂笔记

    2017年6月16号 星期五 空气质量:中度污染~轻度污染 内容:jQuery:remove,bind,attr,on和live,同辈和父辈节点的操作, keyup/keypress/keydown, ...

最新文章

  1. android手机内存这么大,专业解读:为什么安卓手机的内存越来越大?
  2. Oracle分区表基础知识培训
  3. 教育场景下的实时音频解决方案
  4. OSG官方自带的例子程序简介
  5. JS与APP原生控件交互
  6. VCL组件之重要的公用属性
  7. python关键词提取源码,python实现textrank关键词提取
  8. 支付宝小程序封装请求
  9. 使用as3控制动画的播放与暂停
  10. Oracle 常用SQL语句大全(精)
  11. 符冉迪 计算机 培训,采用多模糊支持向量机决策融合的积雨云检测.pdf
  12. 计算机系统后门程序,一种远程控制的后门程序在互联网出现
  13. httpd安装、配置、编译三种访问模式控制https证书的安装访问实例及排错
  14. RESTE MASTER和reset slave
  15. 小型OSPF路由网络的搭建
  16. C# FileInfo类:文件操作
  17. 数据结构与算法笔记:计算思维之经典农夫过河问题C++实现
  18. 硕士研究生期间,必须了解的一些科研工具
  19. 面试官:让你实现一个秒杀系统,你会怎么设计?
  20. 盛邀相聚贵阳,共赴“计算”之约,CNCC2022新闻发布会举行

热门文章

  1. AFN框架和SDWebImage框架的上手体验
  2. C#语言连接Mysql数据库实现增删改查
  3. 第11章 Internet 服务器应用课后习题答案
  4. 一个列中多行求和_Excel 用选项求和及用快捷键快速求和,同时对多单元格求和...
  5. kafka maven没有下载_构建工具的进化:ant, maven, gradle
  6. matlab算概率,用matlab计算概率,再次吐槽某些吧友国战比赛七框选将的建议
  7. xenserver 虚拟机扩容lvm磁盘分区的方法_Linux磁盘扩容
  8. 嵌入式linux+io+优化,嵌入式Linux系统内存优化使用方法研究
  9. 3706 teradata 语句报错_Teradata SQL
  10. linux常用分区工具,总结:Linux系统磁盘分区常用的工具