Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,k;
- cin>>n>>k;
- int m[n][n];
- int a,b;
- int l=0;
- for(int i=0;i<n;i++)
- {
- for(int j=0;j<n;j++)
- {
- m[i][j]=0;
- }
- }
- for(int i=0;i<k;i++)
- {
- cin>>a>>b;
- m[a-1][b-1]=1;
- }
- for(int i=0;i<n;i++)
- {
- for(int j=0;j<n;j++)
- {
- if(m[i][j]==1 && m[j][i]!=1)
- {
- l++;
- }
- }
- }
- cout<<l;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement