Math_2023_11_03_02

package homework;

/**
 * 
no  function
1   1  + 2 = 3
2   4  + 5  + 6 = 7 + 8
3   9  + 10 + 11 + 12 = 13 + 14 + 15
4   16 + 17 + 18 + 19 + 20 = 21 + 22 + 23 + 24 
5   25 + 26 + 27 + 28 + 29 + 30 = 31 + 32 + 33 + 34 + 35


44  x + (x + 1) + ... + (x + 44) = [(x + 44) + 1]  + ... + [(x + 44) + 44]




no   function
1    1    + 2                      = 3
2    4    + 5  + 6                 = 7 + 8
3    9    + 10 + 11 + 12           = 13 + 14 + 15
4    16   + 17 + 18 + 19 + 20      = 21 + 22 + 23 + 24 
5    25   + 26 + 27 + 28 + 29 + 30 = 31 + 32 + 33 + 34 + 35


44   x    + (x + 1) + ... + (x + 44)             = [(x + 44) + 1]  + ... + [(x + 44) + 44]
45   y    + (y + 1) + ... + (y + 44) + (y + 45)  = [(y + 44) + 1]  + ... + [(y + 44) + 44] + [(y + 45) + 45]


y = [(x + 44) + 44] + 1 = x + 88 + 1
y = no * no 


 *
 * @author ZengWenFeng
 * @date 2023.11.03
 * @email 117791303@qq.com
 * @mobile 13805029595
 */
public class Math_2023_11_03_02
{

	public Math_2023_11_03_02()
	{

	}

	/**
	 * 
	 * @author ZengWenFeng
	 * @date 2023.11.03
	 * @email 117791303@qq.com
	 * @mobile 13805029595
	 * @param no
	 * @return
	 */
	public static String calc(int no)
	{
		StringBuilder result = new StringBuilder();
		int first = no * no;
		result.append(first);
		
		int temp = 0;
		for (int i = 0; i < no; i++)
		{
			if (i == 0)
			{
				temp = first + 1;
			}
			else
			{
				temp = temp + 1;
			}
			
			result.append(" + " + temp);
		}
		
		result.append(" = ");
		
		for (int i = 0; i < no; i++)
		{
			temp = temp + 1;
			
			if (i == 0)
			{
				result.append(temp);
			}
			else
			{
				result.append(" + " + temp);
			}
		}
		
		return result.toString();
	}

	public static void main(String[] args)
	{
		int index = 44;
		System.out.println(calc(index));
		
		/**
		 * 
			1936 + 1937 + 1938 + 1939 + 1940 + 1941 + 1942 + 1943 + 1944 + 1945 + 
			1946 + 1947 + 1948 + 1949 + 1950 + 1951 + 1952 + 1953 + 1954 + 1955 + 
			1956 + 1957 + 1958 + 1959 + 1960 + 1961 + 1962 + 1963 + 1964 + 1965 + 
			1966 + 1967 + 1968 + 1969 + 1970 + 1971 + 1972 + 1973 + 1974 + 1975 + 
			1976 + 1977 + 1978 + 1979 + 1980 
			=
			1981 + 1982 + 1983 + 1984 + 1985 + 1986 + 1987 + 1988 + 1989 + 1990 + 
			1991 + 1992 + 1993 + 1994 + 1995 + 1996 + 1997 + 1998 + 1999 + 2000 + 
			2001 + 2002 + 2003 + 2004 + 2005 + 2006 + 2007 + 2008 + 2009 + 2010 + 
			2011 + 2012 + 2013 + 2014 + 2015 + 2016 + 2017 + 2018 + 2019 + 2020 + 
			2021 + 2022 + 2023 + 2024

		 * 
		 */
	}

}

2023.11.03 homework-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值