洛谷月赛A题求解
  • 板块灌水区
  • 楼主Bai__YunMinecraft
  • 当前回复5
  • 已保存回复5
  • 发布时间2022/4/11 10:25
  • 上次更新2023/10/28 04:00:33
查看原帖
洛谷月赛A题求解
652835
Bai__YunMinecraft楼主2022/4/11 10:25

555自己的代码如下,50pts

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=200005;
int t,n,p[N];
int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%d",&n);
		for(int i=1;i<=n;i++)scanf("%d",p+i);
		int s=0;
		for(int i=1;i<=n;i++){
			if(p[i]==-1)printf("1 "),s++;
			else printf("%d ",p[i]-s),s=p[i];
		}
		puts("");
	}
	return 0;
} 
2022/4/11 10:25
加载中...