- 博客(11)
- 收藏
- 关注
原创 每个格子只能走有限次 求有多少人可以走出方格 每个人一次最多移动d格
#include#include#include#includeusing namespace std;const int maxn = 1200;const int INF = 0x3f3f3f3f;struct{ int to,next,flow;}e[maxn * maxn];int S,T;int head[maxn],cnt,d[maxn];void add_ed
2018-03-30 19:09:44 722
原创 hdu 2444 二分图匹配
#include#includeusing namespace std;int G[220][220],vis[220],n,m,mat[220];int dfs(int u,int flag){ if(vis[u] != -1){ if(vis[u] == flag) return 1; else return 0; } vis[u] = flag; for(int
2018-03-26 12:01:09 225
原创 无向图 求加几条边可以得到双联通图 poj 3177
#include#include#include#include using namespace std;const int maxn = 5050;vector mp[maxn];bool g[maxn][maxn];int dfn[maxn],low[maxn],cnt,ans,d[maxn];void Tarjan(int u,int fa){ dfn[u] = low[
2018-03-20 19:34:16 345
原创 给定一个连通图 q个询问 每次加一条边 每次求出有多少个桥 poj 3694
#include#include#include#include#includeusing namespace std;const int maxn = 101000;vector mp[maxn];int dfn[maxn],low[maxn],pre[maxn],p[maxn],cnt,ans;int find(int u){ return u == pre[u]?u:(p
2018-03-20 18:10:32 262
原创 无向图求桥的个数(有重边)
#include#include#include #include#include#includeusing namespace std;vector mp[10010];int ans,low[130],dfn[130],vis[130],cnt;struct node{ int x,y;}a[130];bool cmp(const node u,const node v
2018-03-19 21:48:20 1727
原创 求割点个数
#include#include#include #include#includeusing namespace std;vector mp[10010];int root,low[130],dfn[130],vis[130],num[130],cnt;void Tarjan(int u){ low[u] = dfn[u] = ++cnt; vis[u] = 1; for(
2018-03-19 20:35:20 351
原创 加边 成为强联通分量 poj 1236
#include#include#include#include#include#includeusing namespace std;stack st;vector mp[1010];int low[130],dfn[130],belong[130],vis[130],cnt,scc,n,in[130],out[130];void Tarjan(int u){ vis[u]
2018-03-19 20:03:23 193
原创 uva 12063 含有相同个数0和1 并且是k的倍数 的数的个数 DP
#include#includeusing namespace std;typedef long long LL;LL dp[60][60][120];int main(){ int T,t = 1; int n,mod; scanf("%d",&T); while(T--){ scanf("%d%d",&n,&mod); printf("Case %d: ",t++);
2018-03-07 09:12:45 252
原创 uva 11526
网上推出的公式 2*Σ(n/i) - n*n#include#include#includeusing namespace std;int main(){ int T,n; scanf("%d",&T); while(T--){ long long res = 0; scanf("%d",&n); int m = sqrt(1.0 * n); for( int i
2018-03-07 07:57:43 232
原创 uva 1645
#include<cstdio>using namespace std;const int MOD = 1e9 + 7;int dp[1010];int main(){ int t = 1,n; dp[1] = 1; for(int i = 2;i < 1001;i++){ for(int j = 1;j < i;j++){ if((i - 1) %...
2018-03-06 12:41:54 192
原创 uva 1210 数学
#includeusing namespace std;int vis[10100],pri[10010],num,n;void init(){ num=0; for(int i=2;i<=10010;i++){ if(!vis[i]){ pri[num++]=i; for(int j = i + i;j <= 10010;j += i) vis[j]=1; } }
2018-03-05 12:21:34 306
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人