下笔春蚕食叶声。

题解 CF712A 【Memory and Crow】

看代码
建议先找找规律,推推公式哦~

#include<bits/stdc++.h>//万能头文件
using namespace std;
int main()
{
	int n;
	int k=0,x;//用k表示ai-1,用x表示ai ;
	cin>>n;//读入
	for(int i=1;i<=n;i++)
	{
		cin>>x;//读入
		if(i!=1)
			cout<<x+k<<" ";//根据题目给我们的公式,可以推出bi = ai + ai-1 ;
		k=x;//更新
	 } 
	 cout<<x<<endl;//就是输出n啦
	return 0;
 } 

By 你们最可爱的czy

posted @ 2020-06-11 18:13  ACwisher  阅读(94)  评论(0编辑  收藏  举报