蒟蒻求助红数学题
查看原帖
蒟蒻求助红数学题
119643
潜水的蒟蒻楼主2020/7/4 21:43

这道题

#pragma GCC optimize(3,"Ofast","inline")//日常优化
#include<bits/stdc++.h>//标准头文件
using namespace std;//必要格式
unsigned long long ans,s[35],last;
int main()//烤main包
{
 	//ios::sync_with_stdio(false);//加快速度
	int n=1;
	while(cin>>s[n])n++;
	n--;
	cout<<"the n is:"<<n<<endl;
	for(int i=1;i<=n;i++)
	{
		ans+=last;
		last+=s[i];
		cout<<"the ans is:"<<ans<<" the last is:"<<last<<endl;
		for(int j=i+1;j<=n;j++)
		{
			last+=s[j];
			ans+=last;
			cout<<"the ans is:"<<ans<<" the last is:"<<last<<endl;
		}
	}
	cout<<ans;
	return 0;//祈祷AC
}

这样改了好几次都不能过,就看了题解.题解区里一片叫数学题的(所以不算标题党 )
然后主要的问题就是各位如果不看题解是怎么想到规律的,又怎样培养发现数学规律这方面的能力的?

2020/7/4 21:43
加载中...