首页 > 其他分享 >codeforces 540D - Bad Luck Island

codeforces 540D - Bad Luck Island

时间:2023-07-05 19:32:16浏览次数:30  
标签:return int Island LL Bad 540D res include define


记忆化搜索...


#include <iostream>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <time.h>
#define maxn 1005
#define maxm 40005
#define eps 1e-12
#define mod 1000000007
#define INF 0x3f3f3f3f
#define PI (acos(-1.0))
#define lowbit(x) (x&(-x))
#define mp make_pair
#define ls o<<1
#define rs o<<1 | 1
#define lson o<<1, L, mid 
#define rson o<<1 | 1, mid+1, R
#pragma comment(linker, "/STACK:102400000,102400000")
#define pii pair<int, int> 
typedef long long LL;
typedef unsigned long long ULL;
//typedef int LL;
using namespace std;
LL qpow(LL a, LL b){LL res=1,base=a;while(b){if(b%2)res=res*base;base=base*base;b/=2;}return res;}
LL powmod(LL a, LL b){LL res=1,base=a;while(b){if(b%2)res=res*base%mod;base=base*base%mod;b/=2;}return res;}
// head

double dp[105][105][105][3];
int vis[105][105][105][3];

double dfs(int a, int b, int c, int k)
{
	if(vis[a][b][c][k]) return dp[a][b][c][k];
	if(a < 0 || b < 0 || c < 0) return 0;
	if(k == 0) {
		if(a > 0 && b == 0 && c == 0) return 1;
		if(a == 0) return 0;
	}
	if(k == 1) {
		if(b > 0 && a == 0 && c == 0) return 1;
		if(b == 0) return 0;
	}
	if(k == 2) {
		if(c > 0 && a == 0 && b == 0) return 1;
		if(c == 0) return 0;
	}

	double ans = 0;
	ans += a * b * dfs(a, b-1, c, k);
	ans += a * c * dfs(a-1, b, c, k);
	ans += b * c * dfs(a, b, c-1, k);
	ans /= a * b + b * c + a * c;
	vis[a][b][c][k] = 1;
	return dp[a][b][c][k] = ans;
}

int main()
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	printf("%.11f %.11f %.11f\n", dfs(a, b, c, 0), dfs(a, b, c, 1), dfs(a, b, c, 2));
	
	return 0;
}




标签:return,int,Island,LL,Bad,540D,res,include,define
From: https://blog.51cto.com/u_8692734/6634295

相关文章

  • golang查询数据报错:closing bad idle connection: unexpected read from socket
    原因应用程序在使用驱动的有效空闲连接时候,发现数据库的连接已经失效(因为连接超过wait_timeout时间),用一个失效的连接查数据,所以报错。解决办法将sql驱动SetConnMaxLifetime和SetConnMaxIdleTime设置时间,并且小于数据库的wait_timeout时间(单位秒)。调小wait_timeout。分析......
  • Element-plus的徽章组件el-badge
    Element-plus的徽章组件el-badgeElementPlus是一个基于Vue.js的UI组件库,它提供了一系列的常用UI组件供开发者使用。其中,徽章组件(el-badge)是其中之一。徽章组件(el-badge)可以在其他元素上展示一个小圆点或者一个数字,用于标记某种状态或者数量。徽章可以用于通知用户有......
  • 【五期邹昱夫】CCF-B(IEEE Access'19)Badnets: Evaluating backdooring attacks on deep
    "Gu,Tianyu,etal."Badnets:Evaluatingbackdooringattacksondeepneuralnetworks."IEEEAccess7(2019):47230-47244."  本文提出了外包机器学习时选择值得信赖的提供商的重要性,以及确保神经网络模型安全地托管和从在线存储库下载的重要性。并展示了迁移学习场......
  • 系统断电后,MySQL重启失败:[ERROR] Binlog has bad magic number; It‘s not a binary lo
    系统断电后,MySQL重启失败:[ERROR]Binloghasbadmagicnumber;It‘snotabinarylogfilethatcanbeusedbythisversionofMySQL [ERROR]Can'tinittclog[ERROR]Aborting在Windows系统上,Mysql服务没启动,在启动Mysql服务时,报以下错误: 系统出错。 发生系......
  • 在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory。
    在Linux中执行.sh脚本,异常/bin/sh^M:badinterpreter:Nosuchfileordirectory。 分析:这是不同系统编码格式引起的:在windows系统中编辑的.sh文件可能有不可见字符,所以在Linux系统下执行会报以上异常信息。解决:1)在windows下转换: 利用一些编辑器如UltraEdit或EditPlus等工具先......
  • 江苏工匠杯bad_python
    江苏工匠杯bad_pythonPython逆向拿到附件是一个pyc文件,按照我们常规的python逆向思路,肯定是先试一试能不能uncompyle6反编译.发现无法反编译,我们用010editor查看一下pyc文件的文件头.可以看到文件头是以0D33结尾的330D00000000000000000000000000000000000......
  • Git拉取出现“bad config line 1 in file C:\Users\quber/.gitconfig”的错误
    1、......
  • 关于xfs文件系统-在操作系统中遇到两个uuid一样的-挂载报错-wrong fs type, bad optio
    当操作系统中,出现了两个uuid一样的文件系统(笔者这里是xfs),那么默认就只能挂载成功一个[root@qq-5201351~]#blkid|grepxfs|grep1ea9e784-0692-403c-bed1-bf34a5a86a57/dev/nvme1n1:UUID="1ea9e784-0692-403c-bed1-bf34a5a86a57"BLOCK_SIZE="512"TYPE="xfs"/dev/nvme2......
  • mount: wrong fs type, bad option, bad superblock on xxx.xxx.xxx.xxx:/NAS_NFS
    远程挂在NAS盘或NFS共享盘报错#中文:[root@node02~]#mount-tnfs192.168.1.30:/NAS_NFS/data/mount:文件系统类型错误、选项错误、192.168.1.30:/NAS_NFS上有坏超级块、缺少代码页或助手程序,或其他错误(对某些文件系统(如nfs、cifs)您可能需要......
  • 跨越时空的爱恋——《Island》杂谈
    Preface(好像是这个学期的第一次写长篇杂谈?可歌可泣)《Island》,FrontWing的十五周年纪念作,前翼社也算是业界常青树了,在转型全年龄后发展也不错,20年的出圈《Atri》以及今年夏天的《Ginka》,都算是可圈可点但要说我最早认识的前翼社的作品,思来想去还是这部《Island》(主要因为萌新......