ACM (TJU) : 2990


#include <iostream>
using namespace std;

int main ()
{
	int testCase;
	cin >> testCase;

	while ( testCase-- ) {

		int a [205], b [205];
		int n, m;
		cin >> n;

		int i;
		for ( i = 0; i < n; i++ ) 
			cin >> a [i];

		cin >> m;
		for ( i = 0; i < m; i++ )
			cin >> b [i];

		int count = 0;
		for ( i = 0; i < n; i++ ) {
			for ( int j = 0; j < m; j++ ) {
				if ( a [i] + b [j] == 0 )
					count++;
			}
		}

		cout << count << endl;
	}

	return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s