当前位置:网站首页>POJ 1975 (传递闭包)
POJ 1975 (传递闭包)
2022-06-29 17:47:00 【eva_can(not)survive】
Median Weight Bead - POJ 1975 - Virtual Judgehttps://vjudge.net/problem/POJ-1975#author=SCLchuck可以想到当大于这个或小于这个水滴的数目大于n/2时即可满足
int d[150][150];
void solve() {
memset(d, 0, sizeof(d));
int n, m;
int x, y;
scanf("%d %d", &n, &m);
for (int i = 1; i <= m; i++) {
scanf("%d %d", &x, &y);
d[x][y] = 1;
}
for (int k = 1; k <= n; k++) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
d[i][j] |= d[i][k] & d[k][j];
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++) {
int tmp1 = 0, tmp2 = 0;
for (int j = 1; j <= n; j++) {
if (i == j)
continue;
tmp1 += d[i][j];
tmp2 += d[j][i];
}
if (tmp1 > n / 2 || tmp2 > n / 2)
ans++;
}
printf("%d\n", ans);
}边栏推荐
- 从一个被应用商店坑了的BUG说起
- 关于日期相加减问题
- R language uses user-defined functions to write deep learning linear activation functions and visualize linear activation functions
- 分割回文串[dp + dfs组合]
- L'intercepteur handlerinterceptor personnalisé permet l'authentification de l'utilisateur
- [Oracle] basic knowledge interview questions
- Inherit Chinese virtues, pay attention to the health of the middle-aged and the elderly, and Yurun milk powder has strong respect for the elderly
- What technology is an applet container? Can it help Internet of things enterprises break through the red sea?
- Test dble split function execution + import time-consuming shell script reference
- Selenium upload file
猜你喜欢
随机推荐
Inherit Chinese virtues, pay attention to the health of the middle-aged and the elderly, and Yurun milk powder has strong respect for the elderly
Repair of JSON parsing errors in a collection
MaxCompute字符串替换函数-replace
VB.Net读写NFC Ntag标签源码
Epoll analysis
基于STM32F103ZET6库函数PWM输出实验
Graduation season | Huawei experts teach interview tips: how to get a high salary offer from a large factory?
Li Kou today's question -535 Encryption and decryption of tinyurl
自定義HandlerInterceptor攔截器實現用戶鑒權
Automatic vending machine
R语言使用epiDisplay包的kap函数(kap.2.raters函数)计算Kappa统计量的值(总一致性、期望一致性)、对两个评分对象的结果进行一致性分析、评分的类别为多个类别
Let's start with a bug that was cheated by the app store
How to solve MySQL 1045 error in Linux
Bottom level internal skill cultivation
Selenium file upload method
Fill in the next right node pointer of each node [make good use of each point - > reduce the space-time complexity as much as possible]
自定义HandlerInterceptor拦截器实现用户鉴权
Redux源码分析之createStore
Mongotemplate - distinct use
selenium 文件上传方法


![分割回文串[dp + dfs组合]](/img/7b/221b000984977508f849e19802c2c2.png)






