백준 #25991번 Lots of Liquid

jhj·2024년 2월 15일

백준 JAVA

목록 보기
320/583
import java.util.Scanner;
import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
public class Main {
	public static void main(String[] args) throws IOException{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		StringTokenizer st = new StringTokenizer(br.readLine());
		double total = 0;
		
		for(int i = 0; i < n; i++) {
			double b = Double.parseDouble(st.nextToken());
			total += b * b * b;
		}
		
		System.out.println(Math.cbrt(total));
	}
}

StringTokenizer 쓰기 위하여 import java.util.StringTokenizer;필요
st.nextToken()을 활용하여 입력 받는다.

profile
개발자를 꿈꾸는

0개의 댓글