标签:
Description
所以,我们就可以得到下代码:
1 #include<stdio.h> 2 using namespace std; 3 int sum[100001],n,m; 4 long long ans=0; 5 int main() { 6 scanf("%d%d",&n,&m); 7 for (int i=1;i<=m;++i) { 8 int u,v;scanf("%d%d",&u,&v);sum[u]++;sum[v]++; 9 } 10 for (int i=1;i<=n;++i) ans+=(long long)sum[i]*sum[i]; 11 printf("%I64d\n",ans); 12 return 0; 13 }
顺带介绍下vjudge,虚拟测评
http://acm.hust.edu.cn/vjudge/toIndex.action
[SGU 196] Matrix Multiplication
标签:
原文地址:http://www.cnblogs.com/TonyNeal/p/sgu196.html