游客 Signup | Login
中文 | En

2181 - P506

P506 2-6


数组可以自己赋值, 要求在main函数中调用Equals函数。

Input

Output

1

Examples

Input

no input needed

Output

1

Solution C++

#include <iostream>
using namespace std;
bool Equals(const float*, const float*);
int main()
{
	typedef float DataSet[5];
	DataSet input, output, working;
	DataSet set[3];
	int i, j;
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 5; j++)
			set[i][j] = 0.0f;
	}
	cout << Equals(set[0], set[1]) << endl;
	return 0;
}
bool Equals(const float* a, const float* b)
{
	bool result = true;
	for (int i = 0; i < 5; i++)
		result &= (a[i] == b[i]);
	return result;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题