hdu6243
hdu6243
结论题,每个的概率是(n-1)/n,然后乘以总数n,结果就是 n-1
- #include<iostream>
- #include<cstdio>
- #include<queue>
- #include<algorithm>
- #include<cmath>
- #include<ctime>
- #include<set>
- #include<map>
- #include<stack>
- #include<cstring>
- #define inf 2147483647
- #define ls rt<<1
- #define rs rt<<1|1
- #define lson ls,nl,mid,l,r
- #define rson rs,mid+1,nr,l,r
- #define N 500010
- #define For(i,a,b) for(int i=a;i<=b;i++)
- #define p(a) putchar(a)
- #define g() getchar()
- using namespace std;
- int n,T,cnt;
- int f[N];
- void in(int &x){
- int y=;
- char c=g();x=;
- while(c<''||c>''){
- if(c=='-')y=-;
- c=g();
- }
- while(c<=''&&c>=''){
- x=(x<<)+(x<<)+c-'';c=g();
- }
- x*=y;
- }
- void o(int x){
- if(x<){
- p('-');
- x=-x;
- }
- if(x>)o(x/);
- p(x%+'');
- }
- int main(){
- in(T);
- while(T--){
- in(n);
- //o(n-1);
- cout<<"Case #"<<(++cnt)<<": "<<n-<<".0000000000"<<endl;
- }
- return ;
- }
hdu6243的更多相关文章
- Hdu-6243 2017CCPC-Final A.Dogs and Cages 数学
题面 题意:问1~n的所有的排列组合中那些,所有数字 i 不在第 i 位的个数之和除以n的全排,即题目所说的期望,比如n=3 排列有123(0),132(2),231(3),213(2),312(3) ...
随机推荐
- cv2 & PIL(pillow)显示图像
= OpenCV和PIL中显示图像方式不一样,且支持的格式也不同 = cv在显示图像时是自定义的显示窗口,而PIL中显示是调用操作系统中的默认打开程序 如: import cv2 im = cv2.i ...
- 2018-8-10-VisualStudio-2017-项目格式-自动生成版本号
title author date CreateTime categories VisualStudio 2017 项目格式 自动生成版本号 lindexi 2018-08-10 19:16:52 + ...
- 怎么取消主键自增长的问题(SQL Server)
以前经常会碰到这样的问题,当我们删除了一条自增长列为1的记录以后,再次插入的记录自增长列是2了.我们想在插入一条自增长列为1的记录是做不到的.我们可以通过设置SET IDENTITY_INSERT & ...
- Apache下更改.htaccess文件名称
有时候我们需要更改.htaccess的名称以解决一些问题 比如:Eclipse下是不显示点开头的文件的 所以我们可以使用 Apache的AccessFileName来更改此配置文件的名称 Acces ...
- 【默默努力】vue-pc-app
最近在github上面看到了一个团队的项目,真的非常赞.他们进行vue-cli的二次开发,将项目用自己的方式打包. 今天的这个开源项目地址为:https://github.com/tffe-team/ ...
- 拦截器和自定义注解@interface
1 .拦截器(Interceptor): 用于在某个方法被访问之前进行拦截,然后在Handler执行之前或之后加入某些操作,其实就是AOP的一种实现策略. 拦截用户的请求并进行相应的处理,比如:判断用 ...
- 解决python中import时无法识别自己写的包和模块的方法
我们用pycharm打开自己写的代码,当多个文件之间有相互依赖的关系的时候,import无法识别自己写的文件,但是我们写的文件又确实在同一个文件夹中, 这种问题可以用下面的方法解决: 1)打开File ...
- LintCode刷题笔记-- A+B problem
标签: 位运算 描述 Write a function that add two numbers A and B. You should not use + or any arithmetic ope ...
- 【转载】Python eval
转载 作者博文地址:https://www.cnblogs.com/liu-shuai/ eval 功能:将字符串str当成有效的表达式来求值并返回计算结果. 语法: eval(source[, gl ...
- Activiti流程实例管理
1.启动流程 在完成了流程定义部署后,就要启动流程实例了. /** * 1 启动流程 * 当流程到达一个节点时,会在act_ru_execution表中产生1条数据 * 如果当前节点是用户任务节点,这 ...