Untitled

 avatar
unknown
plain_text
4 years ago
469 B
89
Indexable
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] + " ");
		} 
	}
}
Editor is loading...