通过数表找规律

版权声明:极客编程:www.jikebiancheng.com https://blog.csdn.net/u010356889/article/details/85226388

1.找最容易找到的规律。
2.联系数表的构造过程。
3.推理出要求的项。



 

#include<stdio.h>
#include<stdlib.h>
int main() {
	//程序要求:输入行和列,算出对应的数字。

	int l_Row = 87;   //第几行
	int l_Col = 121;   //第几列

	//第N行的第1列数是多少
	int l_N_Row_One_Col = l_Row * l_Row;

	//第N列的第1行数是多少
	int l_N_Col_One_Row = (l_Col - 1)*(l_Col - 1) + 1;

	int l_Result = NULL;

	if (l_Row >= l_Col) {
		l_Result = l_N_Row_One_Col - l_Col + 1;
	}
	else {
		l_Result = l_N_Col_One_Row + l_Row - 1;
	}

	printf("[%d]行[%d]列=[%d]\n", l_Row, l_Col, l_Result);
	system("pause");

}

猜你喜欢

转载自blog.csdn.net/u010356889/article/details/85226388