jaeseb96   3년 전

In the loop, I read a line of input.

The method std::getline(std::cin, line); reads until a newline, right?

Then I branch according to the last character of the line of input.

When the last character is an exclamation mark, I simply terminate the program.

When the last character is a question mark, I need to print "Quack!" right?

In any other case, I simply print "*Nod*".

Wait, to flush the output stream I need to use std::endl instead of '\n' right?

I quacked the code!

위 input data를 밑의 input data로 수정해주세요

input 데이터에 각 line 마다 빈 줄이 뒤에 추가되어 있는데 이처럼 한출 입력받고 빈줄을 입력 받는 코드 제출시 시간초과가 뜹니다. output 또한 앞과 뒤에 빈 줄이 있는데 BAPC에서 제공하는 output과는 다른 것 같습니다.

In the loop, I read a line of input.
The method std::getline(std::cin, line); reads until a newline, right?
Then I branch according to the last character of the line of input.
When the last character is an exclamation mark, I simply terminate the program.
When the last character is a question mark, I need to print "Quack!" right?
In any other case, I simply print "*Nod*".
Wait, to flush the output stream I need to use std::endl instead of '\n' right?
I quacked the code!

혹시 대화형 input, output을 의도하시고 한건가요?

jh05013   3년 전

인터랙티브 문제의 경우 입력과 출력의 순서를 표현하기 위해 예제에 줄바꿈을 넣기도 합니다.

댓글을 작성하려면 로그인해야 합니다.