2181 - P506

P506 2-6


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

题目输入

题目输出

1

输入/输出样例

题目输入

no input needed

题目输出

1

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;
}
时间限制 1 秒
内存限制 128 MB
讨论 统计
上一题 下一题