-
[1일 1백준 : 10951] A+B - 4Programming/백준 2021. 1. 14. 23:30
문제에서 끝나는 조건을 주지 않았을 때는 EOF 체크를 해주면 된다
Solve 01 :
#include <iostream> int main(void) { std::cin.tie(NULL); std::ios::sync_with_stdio(false); int a, b; while (std::cin >> a >> b) { std::cout << a + b << "\n"; } return 0; }
Solve 02 :
#include <iostream> int main(void) { std::cin.tie(NULL); std::ios::sync_with_stdio(false); int a, b; while (true) { std::cin >> a >> b; if (std::cin.eof()) break; std::cout << a + b << "\n"; } return 0; }
'Programming > 백준' 카테고리의 다른 글
[1일 1백준 : 10818번] 최소 최대 (0) 2021.01.16 [1일 1백준 : 1110번] 더하기 사이클 (0) 2021.01.15 [1일 1백준 : 2439] 별찍기 - 2 (0) 2021.01.13 [1일 1백준 : 2438] 별찍기 - 1 (0) 2021.01.13 [1일 1백준 : 8393번] 합 (Sum) (0) 2021.01.12