1 solutions

  • 0
    @ 2026-1-21 11:53:04
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        int x[1001]={};
        for(int i=0;i<n;i++)cin>>x[i];
        int l=0,r=n-1;
        int c=n/2;
        if(n%2==0)c--;
        for(int i=0;i<=c;i++)
        {
            cout<<x[l]+x[r]<<" ";
            l++;
            r--;
        }
    }
    
    • 1

    Information

    ID
    1813
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    10
    Tags
    # Submissions
    2
    Accepted
    2
    Uploaded By