728x90
3765번: Celebrity jeopardy
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
www.acmicpc.net
문제 풀이
입력값의 수가 정해지지 않는 EOF를 받아야 종료되는 문제이다.
정답 코드
C++
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0)
#define ll long long
int main() {
fast;
string a;
while (1) {
getline(cin, a);
if (cin.eof()) break;
cout << a << "\n";
}
return 0;
}
python
try:
while True :
print(input())
except:
exit(0)
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 4589 - Gnome Sequencing [C++/python] (0) | 2023.03.01 |
---|---|
[BOJ/백준] 4470 - 줄 번호 [C++/python] (0) | 2023.03.01 |
[C++, python] BOJ, 백준 3733 - Shares (0) | 2023.02.28 |
[C++, python] BOJ, 백준 2083 - 럭비 클럽 (0) | 2023.02.28 |
[C++, python] 프로그래머스 - 숫자의 표현 (0) | 2023.02.27 |