当前位置:网站首页>【集训DAY13】Out race【数学】【动态规划】
【集训DAY13】Out race【数学】【动态规划】
2022-07-25 22:24:00 【VL——MOESR】

思路:
我们直接一层一层比,算出概率就行了
c o d e code code
#include<iostream>
#include<cstdio>
#define re register
using namespace std;
const int MAXN = 1050;
int n, d[MAXN][MAXN];
int a[MAXN][MAXN];
double f[MAXN], q[MAXN];
int main() {
scanf("%d", &n);
int len = 1 << n;
for(re int i = 1; i <= len; ++ i)
for(re int j = 1; j <= len; ++ j) scanf("%d", &a[i][j]);
for(re int i = 1; i <= len; ++ i) f[i] = 1.0, d[i][0] = 1, d[i][1] = i;
for(re int i = 1; i <= n; ++ i) {
for(re int j = 1; j <= len; j += (1 << i)) {
re int k = j + (1 << i - 1);
for(re int i1 = 1; i1 <= d[j][0]; ++ i1) {
re int g = d[j][i1];
for(re int j1 = 1; j1 <= d[k][0]; ++ j1) {
re int p = d[k][j1];
q[g] += f[p] * (a[g][p] * 1.0 / 100.0);
q[p] += f[g] * (a[p][g] * 1.0 / 100.0);
}
}
for(re int i1 = 1; i1 <= d[k][0]; ++ i1) ++ d[j][0], d[j][d[j][0]] = d[k][i1];
}
for(re int j = 1; j <= len; ++ j)
f[j] = f[j] * (q[j] / ((1 << i - 1) * 1.0)), q[j] = 0.0;
}
re double maxx = 0.0;
re int ans = n + 1;
for(re int i = 1; i <= len; ++ i)
if(f[i] > maxx) maxx = f[i], ans = i;
printf("%d", ans);
return 0;
}
边栏推荐
- Data governance under data platform
- Compile and decompile
- MySQL - subquery - column subquery (multi row subquery)
- Use of hyperlinks
- Advanced database · how to add random data for data that are not in all user data - Dragonfly Q system users without avatars how to add avatar data - elegant grass technology KIR
- mysql: error while loading shared libraries: libncurses.so. 5: cannot open shared object file: No suc
- synchronized与volatile
- Google analyzes how UA can be transferred to the latest version of GA4
- Wechat applet (anti shake, throttling), which solves the problem that users keep pulling down refresh requests or clicking buttons to submit information; Get the list information and refresh the data
- Can I buy financial products with a revenue of more than 6% after opening an account
猜你喜欢

PySpark数据分析基础:pyspark.sql.SparkSession类方法详解及操作+代码展示

Jenkins+svn configuration

Nuclear power plants strive to maintain safety in the heat wave sweeping Europe

Smart S7-200 PLC channel free mapping function block (do_map)

Playwright tutorial (II) suitable for Xiaobai

ArcGIS10.2配置PostgreSQL9.2标准教程

LabVIEW 开发 PCI-1680U双端口CAN卡

IPv4地址已经完全耗尽,互联网还能正常运转,NAT是最大功臣!

ML-Numpy

Selenium basic use and use selenium to capture the recruitment information of a website (continuously updating)
随机推荐
torchvision
Usage of in in SQL DQL query
Explore the use of self increasing and self decreasing operators
Based on if nesting and function call
arcgis开发常用源码
IPv4地址已经完全耗尽,互联网还能正常运转,NAT是最大功臣!
Use of hyperlinks
科大讯飞智能办公本Air电纸书阅读器,让我的工作生活更加健康
xss-工具-Beef-Xss安装以及使用
2day
To light up all the positions in the string that need to be lit, at least a few lights are needed
SQL中in的用法 DQL 查询
Redis foundation 2 (notes)
字符型常量和字符串常量的区别?
平台架构搭建
[C syntax] void*
What have I experienced to become a harder tester than development?
数据库进阶·如何针对所有用户数据中没有的数据去加入随机的数据-蜻蜓Q系统用户没有头像如何加入头像数据-优雅草科技kir
Don't know mock test yet? An article to familiarize you with mock
Randomly generate 10 (range 1~100) integers, save them to the array, and print the array in reverse order. And find the average value, the maximum value and the subscript of the maximum value, and fin