307768: CF1413A. Finding Sasuke
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Finding Sasuke
题意翻译
给定一个长度为 $n$ 的数组 $a$,请构造一个长度为 $n$ 的数组 $b$ 使得 $\sum\limits_{i=1}^na_i\cdot b_i=0$。要求 $|b_i|\leq 100$ 且 $b_i\neq0$。 $T$ 组数据。$1\leq T\leq 10^3$,$2\leq n\leq 100$,$|a_i|\leq 100$ 且 $a_i\neq 0$,$n$ 是偶数。题目描述
Naruto has sneaked into the Orochimaru's lair and is now looking for Sasuke. There are $ T $ rooms there. Every room has a door into it, each door can be described by the number $ n $ of seals on it and their integer energies $ a_1 $ , $ a_2 $ , ..., $ a_n $ . All energies $ a_i $ are nonzero and do not exceed $ 100 $ by absolute value. Also, $ n $ is even. In order to open a door, Naruto must find such $ n $ seals with integer energies $ b_1 $ , $ b_2 $ , ..., $ b_n $ that the following equality holds: $ a_{1} \cdot b_{1} + a_{2} \cdot b_{2} + ... + a_{n} \cdot b_{n} = 0 $ . All $ b_i $ must be nonzero as well as $ a_i $ are, and also must not exceed $ 100 $ by absolute value. Please find required seals for every room there.输入输出格式
输入格式
The first line contains the only integer $ T $ ( $ 1 \leq T \leq 1000 $ ) standing for the number of rooms in the Orochimaru's lair. The other lines contain descriptions of the doors. Each description starts with the line containing the only even integer $ n $ ( $ 2 \leq n \leq 100 $ ) denoting the number of seals. The following line contains the space separated sequence of nonzero integers $ a_1 $ , $ a_2 $ , ..., $ a_n $ ( $ |a_{i}| \leq 100 $ , $ a_{i} \neq 0 $ ) denoting the energies of seals.
输出格式
For each door print a space separated sequence of nonzero integers $ b_1 $ , $ b_2 $ , ..., $ b_n $ ( $ |b_{i}| \leq 100 $ , $ b_{i} \neq 0 $ ) denoting the seals that can open the door. If there are multiple valid answers, print any. It can be proven that at least one answer always exists.
输入输出样例
输入样例 #1
2
2
1 100
4
1 2 3 6
输出样例 #1
-100 1
1 1 1 -1