hdu6243
结论题,每个的概率是(n-1)/n,然后乘以总数n,结果就是 n-1

  1. #include<iostream>
  2. #include<cstdio>
  3. #include<queue>
  4. #include<algorithm>
  5. #include<cmath>
  6. #include<ctime>
  7. #include<set>
  8. #include<map>
  9. #include<stack>
  10. #include<cstring>
  11. #define inf 2147483647
  12. #define ls rt<<1
  13. #define rs rt<<1|1
  14. #define lson ls,nl,mid,l,r
  15. #define rson rs,mid+1,nr,l,r
  16. #define N 500010
  17. #define For(i,a,b) for(int i=a;i<=b;i++)
  18. #define p(a) putchar(a)
  19. #define g() getchar()
  20.  
  21. using namespace std;
  22. int n,T,cnt;
  23. int f[N];
  24. void in(int &x){
  25. int y=;
  26. char c=g();x=;
  27. while(c<''||c>''){
  28. if(c=='-')y=-;
  29. c=g();
  30. }
  31. while(c<=''&&c>=''){
  32. x=(x<<)+(x<<)+c-'';c=g();
  33. }
  34. x*=y;
  35. }
  36. void o(int x){
  37. if(x<){
  38. p('-');
  39. x=-x;
  40. }
  41. if(x>)o(x/);
  42. p(x%+'');
  43. }
  44. int main(){
  45. in(T);
  46. while(T--){
  47. in(n);
  48. //o(n-1);
  49. cout<<"Case #"<<(++cnt)<<": "<<n-<<".0000000000"<<endl;
  50. }
  51. return ;
  52. }

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. cv2 & PIL(pillow)显示图像

    = OpenCV和PIL中显示图像方式不一样,且支持的格式也不同 = cv在显示图像时是自定义的显示窗口,而PIL中显示是调用操作系统中的默认打开程序 如: import cv2 im = cv2.i ...

  2. 2018-8-10-VisualStudio-2017-项目格式-自动生成版本号

    title author date CreateTime categories VisualStudio 2017 项目格式 自动生成版本号 lindexi 2018-08-10 19:16:52 + ...

  3. 怎么取消主键自增长的问题(SQL Server)

    以前经常会碰到这样的问题,当我们删除了一条自增长列为1的记录以后,再次插入的记录自增长列是2了.我们想在插入一条自增长列为1的记录是做不到的.我们可以通过设置SET IDENTITY_INSERT & ...

  4. Apache下更改.htaccess文件名称

    有时候我们需要更改.htaccess的名称以解决一些问题 比如:Eclipse下是不显示点开头的文件的 所以我们可以使用  Apache的AccessFileName来更改此配置文件的名称 Acces ...

  5. 【默默努力】vue-pc-app

    最近在github上面看到了一个团队的项目,真的非常赞.他们进行vue-cli的二次开发,将项目用自己的方式打包. 今天的这个开源项目地址为:https://github.com/tffe-team/ ...

  6. 拦截器和自定义注解@interface

    1 .拦截器(Interceptor): 用于在某个方法被访问之前进行拦截,然后在Handler执行之前或之后加入某些操作,其实就是AOP的一种实现策略. 拦截用户的请求并进行相应的处理,比如:判断用 ...

  7. 解决python中import时无法识别自己写的包和模块的方法

    我们用pycharm打开自己写的代码,当多个文件之间有相互依赖的关系的时候,import无法识别自己写的文件,但是我们写的文件又确实在同一个文件夹中, 这种问题可以用下面的方法解决: 1)打开File ...

  8. LintCode刷题笔记-- A+B problem

    标签: 位运算 描述 Write a function that add two numbers A and B. You should not use + or any arithmetic ope ...

  9. 【转载】Python eval

    转载 作者博文地址:https://www.cnblogs.com/liu-shuai/ eval 功能:将字符串str当成有效的表达式来求值并返回计算结果. 语法: eval(source[, gl ...

  10. Activiti流程实例管理

    1.启动流程 在完成了流程定义部署后,就要启动流程实例了. /** * 1 启动流程 * 当流程到达一个节点时,会在act_ru_execution表中产生1条数据 * 如果当前节点是用户任务节点,这 ...