Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- long long int a[1000000],b[100000];
- int main()
- {
- long long int n,i,k,r,prev,previ,prevn,temp;
- scanf("%lld",&n);
- for(i=1;i<=n/2;i++){
- scanf("%lld",&b[i]);
- }
- prev=b[1];
- previ=0;
- prevn=b[1];
- for(i=1;i<=n/2;i++){
- if(b[i]<=prev){
- a[i]=previ;
- prevn=b[i]-previ;
- a[n-i+1]=prevn;
- }
- else{
- previ=b[i]-prevn;
- prevn=b[i]-previ;
- a[i]=previ;
- a[n-i+1]=prevn;
- }
- prev=b[i];
- previ=a[i];
- prevn=a[n-i+1];
- }
- for(i=1;i<=n;i++){
- printf("%d",a[i]);
- if(i!=n)
- printf(" ");
- else
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement