백준 #2010번 플러그

jhj·2024년 3월 4일

백준 JAVA

목록 보기
442/583
//2010번 플러그

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] a = new int[n];
		int total = 0;
		
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		int min = a[0];
		for(int i = 0; i < n; i++) {
			min = Math.min(min, a[i]);
		}
		
		for(int i = 0; i < n; i++) {
			total += a[i] - 1;
		}
		total++;
		System.out.println(total);
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글