A. Finding Sasuke

cf 1435 A
把每个数从1到n倒序输出pow(-1,i)*a[n-i+1]

#include<bits/stdc++.h>
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
//#pragma GCC optimize(3)
//#pragma GCC optimize(2)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int maxn = 1000010;
const int mod = 1e9 + 7;
ll i, j, t, k, l, r;
ll ans, sum, cnt, sum1, sum2, num;
ll a[maxn], b[maxn], vis[maxn], lsh[maxn];
ll flag = 0, n, m, x, y, c, q;
vector<vector <vector <vector <int> > > >dp(71,vector<vector<vector<int>>>(71,vector<vector<int>>(71,vector<int>(35,-1))));
vector< vector<int> >mp(70,vector<int >(70));
template <typename T>
void read(T& x) /*快读*/
{
    x = 0;
    int f = 1;
    char ch = getchar();
    while (!isdigit(ch))
    {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (isdigit(ch))
    {
        x = x * 10 + (ch ^ 48);
        ch = getchar();
    }
    x *= f;
    return;
}
int main()
{
    cin>>t;
    while(t--)
    {
        read(n);
        rep(i,1,n)
        cin>>a[i];
        ll mid=n/2;
        rep(i,1,n)
        {
            ans=pow(-1,i);
            b[i]=ans*a[n-i+1];
            cout<<b[i]<<" ";
        }
        cout<<endl;
    }
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值