📍 謎紛芥索紀 (Small)
https://www.acmicpc.net/problem/14730
항의 계수와 차수를 곱한 값을 더해주면 된다.
✨ 전체코드 ✨
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int N = Integer.parseInt(sc.readLine());
int sum = 0;
for(int i=0; i<N; i++){
st = new StringTokenizer(sc.readLine());
int C = Integer.parseInt(st.nextToken());
int K = Integer.parseInt(st.nextToken());
sum += C*K;
} System.out.println(sum);
}
}
🌀 성능
- 메모리 : 14,116 KB
- 시간 : 120 ms
실버5가 아니라 브론즈5 해도 될 듯
Large 버전도 있던데 바로 풀어봐야겠다.
'Algorithm > Boj' 카테고리의 다른 글
[JAVA | 백준] #1748 수 이어 쓰기 1 (4) | 2024.08.07 |
---|---|
[JAVA | 백준] #16304 A Prize No One Can Win 🦄 (0) | 2024.08.06 |
[JAVA | 백준] #17093 Total Circle (0) | 2024.08.06 |
[JAVA | 백준] #5337 웰컴 🤗 (0) | 2024.08.06 |
[JAVA | 백준] #9159 What is the air speed velocity... 🌬️ (0) | 2024.07.29 |