Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
469 B
84
Indexable
Never
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 
		
		int n = sc.nextInt(); 
		int arr[] = new int[50]; 
		
		for(int i = 0; i < n; i++) { 
			arr[i] = sc.nextInt();
		}  
		
		for(int i = 0; i < n; i++) { 
			if(i % 2 != 0) { 
				arr[i] +=  Math.abs(arr[i-1] - arr[i+1]) ;
			}
		}   
		for(int i = 0; i < n; i++) { 
			System.out.print(arr[i] + " ");
		} 
	}
}