#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. [SoapUI] 获取当前时间包括年月日时分秒来作为命名

    import java.text.SimpleDateFormat GregorianCalendar calendar = new GregorianCalendar() def dateForma ...

  2. hive 报错 java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

    Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable ...

  3. XE7 里面添加自定义View

    经过xe4,xe5,xe6 这么几个版本的磨合,易博龙终于在今年9月推出了统一的多平台开发版本-XE7. 经过最近几天的测试,非常不错.如果各位同学在做移动开发,强烈建议使用XE7. 前面几个版本可以 ...

  4. hdu-1131(卡特兰数+大数)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1131 思路:R(x)=h(x)*n!=C(n,2*n)*n!=A(n+2,n*2); #include ...

  5. 什么是DNS服务器

    DNS:是做域名解析的.我们平时所输入的网址,都是某台服务器的主机名,比如www.BAIDU.COM,主机之间通讯是通过IP地址访问的,这个是有需要某个机制,把地址解析成名字,因为IP地址是一串数字, ...

  6. 使用async-http-client实现异步批量http请求

    最近项目中需要在微服务中调用rest接口,而且需要调用得次数很多,所以同步得http客户端已经不满足要求,在网上查阅资料后发现了async-http-client这个包得性能不错,所以写了个demo测 ...

  7. SPI通信协议(SPI总线)学习

    1.什么是SPI? SPI是串行外设接口(Serial Peripheral Interface)的缩写.是 Motorola 公司推出的一 种同步串行接口技术,是一种高速的,全双工,同步的通信总线. ...

  8. mysql中要根据某个逗号分割的字符串关联查询另一张表的数据

    首先观察下面的查询 select * from company where f_id in ('210','205','208') select * from company where f_id i ...

  9. dubbo在eclipse中无法读取到dubbo.xsd

    报错信息如下: Multiple annotations found at this line:– cvc-complex-type.2.4.c: The matching wildcard is s ...

  10. [LeetCode] Unique Paths && Unique Paths II && Minimum Path Sum (动态规划之 Matrix DP )

    Unique Paths https://oj.leetcode.com/problems/unique-paths/ A robot is located at the top-left corne ...