본문 바로가기
휴지통/알고리즘 & 자료구조

백준 11720

by 신재권 2021. 7. 13.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main11720 {

	public static void main(String[] args) throws IOException {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		int N  = Integer.parseInt(bf.readLine());
		String num = bf.readLine();
		int number =0;
		int sum = 0;
		for(int i=0; i<N; i++){
			number = num.charAt(i)- '0';
			sum += number;
		}
		System.out.println(sum);
	}

}

'휴지통 > 알고리즘 & 자료구조' 카테고리의 다른 글

프림 알고리즘(Prim Path)-(1)  (0) 2021.07.14
백준 10809  (0) 2021.07.13
크루스칼 알고리즘(KruskalPath)  (0) 2021.07.13
다익스트라 최단 경로(DijkstraPath)  (0) 2021.07.12
백준 11654  (0) 2021.07.10