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