#include<bits/stdc++.h>
using namespace std;
int x,n,pp,ct[10000];
long double f[210][(1<<8)+5][240][2],p,ans;
int main(){
	freopen("exp.in","r",stdin);
	freopen("exp.out","w",stdout);
	scanf("%d%d%d",&x,&n,&pp);
	p=pp/100.0;
	for(int i=1;i<=2000;i++)
		ct[i*2]=ct[i]+1;
	int d=x&1,b=x&255,c=0;
	x>>=8;
	while(x&&(x&1)==d){
		x>>=1;
		c++;
	}
	f[0][b][c][d]=1.0;
	for(int i=0;i<n;i++)
		for(int j=0;j<=255;j++)
			for(int k=0;k<=230;k++)
				for(int l=0;l<=1;l++){
					int b,c,d;
					if(j==255){
						b=0;
						if(l==1){
							d=0;
							c=k;
						}
						else{
							d=1;
							c=1;
						}
					}
					else{
						b=j+1;
						d=l;
						c=k;
					}
					f[i+1][b][c][d]=f[i+1][b][c][d]+f[i][j][k][l]*(1-p);
					//+1
					if(j>127){
						b=(j*2)&255;
						int td=(j*2)&256;
						td>>=8;
						if(td!=l){
							c=1;
							d=td;
						}
						else{
							c=k+1;
							d=l;
						}
					}
					else{
						b=j*2;
						if(l!=0){
							d=0;
							c=1;
						}
						else{
							d=0;
							c=k+1;
						}
					}
					f[i+1][b][c][d]=f[i+1][b][c][d]+f[i][j][k][l]*p;
					//*2
				}
	for(int j=1;j<=255;j++)
		for(int k=0;k<=230;k++)
			for(int l=0;l<=1;l++)
				ans=ans+f[n][j][k][l]*ct[j];
	for(int k=0;k<=230;k++)
		ans=ans+f[n][0][k][1]*8+f[n][0][k][0]*(8+k);
	printf("%.12Lf\n",ans);
}

我怎麼天天犯傻逼錯誤!

jzoj5805的更多相关文章

随机推荐

  1. 调试Javascript代码(浏览器F12)

    在浏览器中按F12,会弹出一个窗口,这个窗口是给开发人员用于网站调试用的,可以分析网页的问题出现在哪里,同时可以调试多种脚本,是一个开发者工具. 想通过encodeURIComponent将C24\C ...

  2. samtools 工具

    软件地址: http://www.htslib.org/ 功能三大版块 : Samtools Reading/writing/editing/indexing/viewing SAM/BAM/CRAM ...

  3. 使用JDBC连接MySql时出现:The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration

    在连接字符串后面加上?serverTimezone=UTC 其中UTC是统一标准世界时间. 完整的连接字符串示例:jdbc:mysql://localhost:3306/test?serverTime ...

  4. 2018.10.15 bzoj4570: [Scoi2016]妖怪(凸包)

    传送门 不得不说这题有点东西啊. 看到题第一眼二分,用二次函数求范围来进行checkcheckcheck,20分滚粗了233. 于是开始思考正解. 发现可以把每只怪物的二元组属性看成二维坐标. 这时对 ...

  5. 一个 图片 滚动 飞入的css特效

    @keyframes bounceInLeft { from, 60%, 75%, 90%, to {animation-timing-function: cubic-bezier(0.215, 0. ...

  6. 21 Survival of Desert Life 沙漠生命的延续

    Survival of Desert Life 沙漠生命的延续 ① Some desert animals can survive the very strong summer heat and dr ...

  7. IntelliJ IDEA 2017版 SpringBoot的web项目补充

    一.注解        @SpringBootApplication:Spring Boot项目的核心注解,主要目的是开启自动配置.        @Configuration:这是一个配置Sprin ...

  8. IntelliJ IDEA 2017版 springloaded实现热部署

    1.配置pom.xml文档 <?xml version="1.0" encoding="UTF-8"?> <project xmlns=&qu ...

  9. HDU 5957 Query on a graph (拓扑 + bfs序 + 树剖 + 线段树)

    题意:一个图有n个点,n条边,定义D(u,v)为u到v的距离,S(u,k)为所有D(u,v)<=k的节点v的集合 有m次询问(0<=k<=2): 1 u k d:将集合S(u,k)的 ...

  10. MEF程序设计指南

    ############################################################################################## ##### ...