标签:splay pac space end 相关 代码 can char s int
#include <bits/stdc++.h>
using namespace std;
int n; char s[2010];
bitset <2010> mp[2010];
int main () {
cin >> n;
register int i, j, k;
for (i = 0; i < n; ++i) {
scanf ("%s", s);
for (j = 0; j < n; ++j) {
mp[i][j] = s[j] - '0';
}
}
for (k = 0; k < n; ++k) {
for (i = 0; i < n; ++i) {
if (mp[i][k]) mp[i] |= mp[k];
}
}
int ans = 0;
for (i = 0; i < n; ++i) ans += mp[i].count ();
cout << ans << endl;
}
Luogu P4306 [JSOI2010]连通数 传递闭包
标签:splay pac space end 相关 代码 can char s int
原文地址:https://www.cnblogs.com/maomao9173/p/10441146.html