A1 = ?

                                                          A1 = ?


<div style="text-align: left;"><pre name="code" class="cpp">#include<cstdio>
#include<string>
#include<string>
#include<iostream>
#include<algorithm>
const int M = 10000;
using namespace std;
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		double a,b,c[M]={0},sum=0;
		scanf("%lf%lf",&a,&b);
		for(int i=1;i<=n;i++)
		{
			scanf("%lf",&c[i]);
			sum+=(n+1-i)*c[i];
		}
		printf("%.2lf\n",(n*a+b-2*sum)/(n+1));
	}
	return 0;
}<span style="white-space:pre">			</span>//---邱新磊
本题在于解方程,得公式!
① A1 = (A0+A2)/2-C1;
② A2 = (A1+A3)/2-C2;
.....
n An = (A(n-1)+A(n+1))/2-Cn;

n项相加得An=A0+A(n+1)-A1-2*(C1+C2+...+Cn);
当n=2时 将得到的An=A0+A(n+1)-A1-2*(C1+C2+...+Cn)带入一式解出A1,一直带入一式直到n=n为止就能得到A1=(nA0+A(n+1)-2*(nC1+(n-1)C2+...+1Cn))/(n+1)

2025-07-18 09:08:33.930 [TID: N/A] [http-nio-8000-exec-2] DEBUG o.s.j.s.SQLErrorCodeSQLExceptionTranslator -Translating SQLException with SQL state '42601', error code '0', message [ERROR: syntax error at or near "AND" 位置:1302] for task [ ### Error querying database. Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or near "AND" 位置:1302 ### The error may exist in file [E:\LG\api\so\target\classes\mybatis\Sosoqq1Repository.xml] ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: select confmWt,totalOnOrderWt, (confmWt-totalOnOrderWt) as "notEntrusted" from ( AND (A1.ORDER_MONTH >= ?) AND (A1.ORDER_MONTH <= ?) and (A1.COMPANY_CODE = ?) and (A1.ORDER_TYPE_CODE = ?) and (A1.SALE_ORG_CODE = ?) and (A1.SALE_DEPT_CODE = ?) ) ### Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or near "AND" 位置:1302 ] 2025-07-18 09:08:33.958 [TID: N/A] [http-nio-8000-exec-2] DEBUG o.s.web.servlet.DispatcherServlet -Failed to complete request: org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or near "AND" 位置:1302 ### The error may exist in file [E:\LG\api\so\target\classes\mybatis\Sosoqq1Repository.xml] ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: select confmWt,totalOnOrderWt, (confmWt-totalOnOrderWt) as "notEntrusted" from ( AND (A1.ORDER_MONTH >= ?) AND (A1.ORDER_MONTH <= ?) and (A1.COMPANY_CODE = ?) and (A1.ORDER_TYPE_CODE = ?) and (A1.SALE_ORG_CODE = ?) and (A1.SALE_DEPT_CODE = ?) ) ### Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or near "AND" 位置:1302 ; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: syntax error at or near "AND" 位置:1302 execute XApplicationEvent ...class org.springframework.web.context.support.ServletRequestHandledEvent 2025-07-18 09:08:33.973 [TID: N/A] [http-nio-8000-exec-2] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] -Servlet.service() for servlet [dispatcherServlet] in context with path [/api/so] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or near "AND" 位置:1302 ### The error may exist in file [E:\LG\api\so\target\classes\mybatis\Sosoqq1Repository.xml] ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: select confmWt,totalOnOrderWt, (confmWt-totalOnOrderWt) as "notEntrusted" from ( AND (A1.ORDER_MONTH >= ?) AND (A1.ORDER_MONTH <= ?) and (A1.COMPANY_CODE = ?) and (A1.ORDER_TYPE_CODE = ?) and (A1.SALE_ORG_CODE = ?) and (A1.SALE_DEPT_CODE = ?) ) ### Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or near "AND" 位置:1302 ; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: syntax error at or near "AND" 位置:1302] with root cause org.postgresql.util.PSQLException: ERROR: syntax error at or near "AND" 位置:1302
最新发布
07-19
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值