标签:
4 4 1 2 1 3 2 3 2 4
18
#pragma comprint(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<string> #include<iostream> #include<cstring> #include<cmath> #include<stack> #include<queue> #include<vector> #include<map> #include<stdlib.h> #include<time.h> #include<algorithm> #define LL __int64 #define FIN freopen("in.txt","r",stdin) using namespace std; const int MAXN=10000+5; int cnt[MAXN]; struct node { int x,y; }edge[100000+5]; int main() { int n,m; while(scanf("%d %d",&n,&m)!=EOF) { memset(cnt,0,sizeof(cnt)); for(int i=0;i<m;i++) { int u,v; scanf("%d %d",&u,&v); cnt[u]++; cnt[v]++; edge[i].x=u; edge[i].y=v; } long long ans=0; for(int i=0;i<m;i++) { int u=edge[i].x; int v=edge[i].y; ans+=cnt[u]; ans+=cnt[v]; } printf("%lld\n",ans); } return 0; }
ACDream 1213 Matrix Multiplication (01矩阵处理)
标签:
原文地址:http://www.cnblogs.com/clliff/p/4761843.html