2 3 1 2 1 2 2 1 3 3 1 1 1 3 3 2 2 2 1 1 1 1
1 3 1
好吧。。水一发
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
bool ma[1002][1002];
int main()
{
int n,m;
while(~scanf("%d%d",&n,&m))
{
int u,v;
memset(ma,0,sizeof(ma));
int ans=m;
for(int i=1;i<=m;i++)
{
scanf("%d%d",&u,&v);
if(!ma[u][v])
ma[u][v]=ma[v][u]=1;
else
ans--;
}
printf("%d\n",ans);
}
return 0;
}
原文:http://blog.csdn.net/qq_16255321/article/details/39228475