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的更多相关文章

  1. 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) ...

随机推荐

  1. matlab-使用技巧

    sel(1:100); 1 2 3 4 5 ...100 X(sel, :); 1.......2.......3.......4.......5..........100...... nn_para ...

  2. oi知识表

  3. 跟我一起使用create-react-app脚手架搭建vw-layout解决方案

    之前也是看过大漠的vw适配Vue-cli,我自己写H5,还有使用vue做项目的时候,会搭建大漠博客中的那一套. 现在在github上面,看见了一位博主使用create-react-app也是用vw适配 ...

  4. centos6 php5.4 升級到php 5.6

    因Centos6中的PHP版本有点底,需要升级PHP版本 [vagrant@localhost ~]$ php -v PHP 5.4.45 (cli) (built: Sep 30 2015 15:0 ...

  5. 在双重for循环内部使用async异步请求axios中遇到的问题

    在methods中的方法 async getPro () { let _this = this let newArr = [] await axios.get(`api/v1/dailyProTbms ...

  6. ubuntu 环境变量修改和恢复总结

    通常设置环境变量有三种方法: 一.临时设置export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64export PATH=$JAVA_HOME/:$ ...

  7. VUE环境下获取当前时间并格式化--按秒数更新

    <el-col :span="8"><div class="grid-content title-time"> {{date}}< ...

  8. 我眼中javascript的这些年

    写了两年多的js了吧,一开始的目标并没有很学术,我只想安安静静做个很厉害的开发者.但是总是沉溺在一种语言里,会让人误以为这种语言很厉害,就像只在村子里混的话,我觉得我自己可以逆天,村外有人,编程世界也 ...

  9. linux ssh密钥认证, 免密码登陆

    1. 客户端生成密钥 # mkdir ~/.ssh # chmod ~/.ssh # cd ~/.ssh 生成RSA密钥 # ssh-keygen -t rsa (然后连续三次回车) 2. 把公钥传到 ...

  10. Composer的简介说明与安装

    https://mp.weixin.qq.com/s/aSZRhoa2-JjKOTRVhPdxdQ Composer 是 PHP 的一个依赖管理工具.它允许你申明项目所依赖的代码库,它会在你的项目中为 ...