Finding Sasuke CodeForces - 1413A

原题链接
考察:构造
思路:
  这题的构造应该很简单吧....两两构造即可.本蒟蒻想到了正确思路但被我否了!!!我是彩笔WA两次!!!!

Code

#include <iostream>
#include <cstring> 
#include <algorithm>
using namespace std;
const int N = 105;
int n,b[N],a[N];
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d",&n);
		for(int i=1;i<=n;i+=2)
		{
			scanf("%d%d",&a[i],&a[i+1]);
			b[i] = -a[i+1],b[i+1] = a[i];
		}
		for(int i=1;i<=n;i++) printf("%d ",b[i]);
		printf("\n");
	}
	return 0;
}

posted @ 2021-05-25 11:04  acmloser  阅读(37)  评论(0编辑  收藏  举报