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) ...
随机推荐
- <每日一题>题目11:以文件夹名称作为参数,返回该文件夹下所有文件的路径
''' 分析: 1.知道文件夹名称(假设是形如:E:\\software\\Notepad++),很显然可以通过OS模块去求 2.OS.listdir(sPath),列出文件夹内所有的文件和文件夹,以 ...
- 注解@Qualifier@Primary
在Controller中需要注入service那么我的这个server有两个实现类如何区分开这两个impl呢 根据注入资源的注解不同实现的方式有一点小小的区别 在Controller中使用 @Auto ...
- 记 openSUSE 42.3 升级到Leap 15.0
先将系统的软件更新到最新版本 sudo zypper update 删除42.3的软件源,若有其他数据源,如nginx的,也需要一并删除,可使用zypper lr -d 来查询 sudo zypper ...
- css---4表单相关伪类
input:enabled{ color:red;} input:disabled{ color:blue;} enabled or disable 表单的状态 input:checked{ widt ...
- Atcoder arc085
C:HSI 期望模型,不想说. #include<cstdio> using namespace std; typedef long long ll; int main() { int n ...
- task code
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks ...
- nodejs vue 微信公众号开发(二)申请微信测试号
1.打开微信测试公众号开发平台http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login 扫码登陆
- cycloneii normal mode vs. arithmetic mode
Combout = F(data1, data2, data3 or cin, data4) 在 arithmetic mode,只有 data1\data2 参加运算. 4-LUT到2个3-LUT的 ...
- Django项目在linux上运行
目录 前言 上传 解压 制作启动脚本 这是一篇关于如何在linux下,以后台进程的方式运行服务,命令改改基本上就通用了. 前言 我们在windows本地开发完Django项目后,需要把项目部署到lin ...
- mysql 存中文失败问题
在向数据库存中文时报错: 将中文字段的字符集改为utf8即可: 成功截图: