개발/Coding Test
.NET 10952번 백준
copcat
2020. 11. 8. 17:52
접근 방법
A,B는 계속 입력받으면서 A+B 출력하지만 0, 0 값이 들어가면 멈춘다.
module module1
Public Shared sub Main
do while true
Dim input As String() = Console.ReadLine().Split()
Dim A As Integer = Integer.Parse(input(0))
Dim B As Integer = Integer.Parse(input(1))
If A = 0 AndAlso B = 0 Then
Exit do
End If
Console.WriteLine(A+B)
loop
End Sub
End module
input 이라는 문자열 배열 변수를 만들어 입력값 하나하나 Split로 구분하였다.
다른 방법으로는
Dim tmp as string = Console.ReadLine()
Dim tmp_split as String() = tmp.split(" ")
뭐 이런식으로 공백을 구분,,?해주는 것도 있다
맨 아래서부터 위로 올라가는 순
- A+B를 따로 변수에 담아 보여준 경우
- Console.Readline.split()로 한번에 한 경우
Dim tmp as string = Console.ReadLine()
Dim tmp_split as String() = tmp.split(" ")
음,,, 왜 메모리와 시간에서 무슨 차이가 있는 지는 잘 모르겠다,,,,,
찝찝,,ㅋㅋㅋㅋ
반응형