public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
int temp = 0;
for(int i=0; i<s.length(); i++) {
if(temp + ((int)s.charAt(i)-'0') <= 9) {
temp = temp + ((int)s.charAt(i) - '0');
} else {
temp = temp * ((int)s.charAt(i) - '0');
}
}
System.out.println(temp);
}
}
'Algorithm > 이코테' 카테고리의 다른 글
완전 탐색 문제 유형(2) - 왕실의 나이트 (0) | 2022.12.28 |
---|---|
완전 탐색 문제 유형(1) - 시각 (0) | 2022.12.28 |
구현 문제 유형(1) - 상하좌우 (0) | 2022.12.13 |
그리디 문제 유형(3) - 모험가 길드 (0) | 2022.12.06 |
그리디 문제 유형(1) - 1이 될 때까지 (0) | 2022.12.04 |