10 7
1 2
3 3
3 0
3 3
6 2
2 1
8 2
3
#include
#include
using namespace std;
int main() {
int n , k ;
cin >> n >> k;
int res=0;
int temp1=0;
int temp2=0;
double *arr=new double [n];
for (int i = 0; i <n ; i++) {
arr[i]= 0;
}
arr[0]= 1;
for (int i = 0; i < k; i++) {
cin>>temp1>>temp2;
if (!arr[temp2]){
res++;
arr[temp1]= 1;
} else{
arr[temp1]= 1;
}
}
cout<<res<<endl;
delete []arr;
return 0;
}
用bool数组 部分数据不通过 ,所以后面换成double型了