문제 출처 : https://www.acmicpc.net/problem/3765
언어 : Kotlin
문제 설명 :
It’s hard to construct a problem that’s so easy that everyone will get it, yet still difficult enough to be worthy of some respect. Usually, we err on one side or the other. How simple can a problem really be?
Here, as in Celebrity Jepoardy, questions and answers are a bit confused, and, because the participants are celebrities, there’s a real need to make the challenges simple. Your program needs to prepare a question to be solved --- an equation to be solved --- given the answer. Specifically, you have to write a program which finds the simplest possible equation to be solved given the answer, considering all possible equations using the standard mathematical symbols in the usual manner. In this context, simplest can be defined unambiguously several different ways leading to the same path of resolution. For now, find the equation whose transformation into the desired answer requires the least effort.
For example, given the answer X = 2, you might create the equation 9 – X = 7. Alternately, you could build the system X > 0; X^2 = 4. These may not be the simplest possible equations. Solving these mind-scratchers might be hard for a celebrity.
입력 :
Each input line contains a solution in the form =
출력 :
For each input line, print the simplest system of equations which would to lead to the provided solution, respecting the use of space exactly as in the input.
제한 사항 :
- 시간 제한 : 1초
- 메모리 제한 : 128MB
입출력 예 :
입력 | 출력 |
Y = 3 X=9 |
Y = 3 X=9 |
풀이 :
import java.io.BufferedReader
import java.io.BufferedWriter
import java.io.InputStreamReader
import java.io.OutputStreamWriter
fun main() = with(BufferedReader(InputStreamReader(System.`in`))) {
val bw = BufferedWriter(OutputStreamWriter(System.out))
val sb = StringBuilder()
while (true) {
val input = readLine()
if (input.isNullOrEmpty()) break
sb.appendLine(input)
}
bw.write(sb.toString())
bw.flush()
bw.close()
}
'백준 > 문제' 카테고리의 다른 글
6443번: 애너그램 (0) | 2024.04.08 |
---|---|
1283번: 단축키 지정 (0) | 2024.04.08 |
1855번: 암호 (0) | 2024.04.05 |
9324번: 진짜 메시지 (1) | 2024.04.05 |
11091번: 알파벳 전부 쓰기 (0) | 2024.04.04 |
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!