C++ 代码
#include<bits/stdc++.h>
using namespace std;
const int N=100010;
bool q[N];
int n,k,x,y,res=0;
int main(){
cin>>n>>k;
q[0]=1;
while(k--){
cin>>x>>y;
if(!q[y]) res++;
q[x]=1;
}
cout<<res;
return 0;
}