백준53 [C++] 백준 5358: Football Team 문제 https://www.acmicpc.net/problem/5358 5358번: Football Team Print the same list of names with every ‘i’ replaced with an ‘e’, every ‘e’ replaced with an ‘i’, every ‘I’ replaced with an ‘E’, and every ‘E’ replaced with an ‘I’. www.acmicpc.net 해결방법 while문 안에 getline(cin, str) 함수를 사용하여 입력값이 없을 때 까지 입력받고 문자열을 for문으로 하나씩 보면서 e는 i로, E는 I로, i는 e로, I는 E로 변경 후 출력한다. 코드 #include #include using namespace .. 2023. 5. 15. [C++] 백준 6825: Body Mass Index 문제 https://www.acmicpc.net/problem/6825 6825번: Body Mass Index The Body Mass Index (BMI) is one of the calculations used by doctors to assess an adult’s health. The doctor measures the patient’s height (in metres) and weight (in kilograms), then calculates the BMI using the formula BMI = weight/(height × height). www.acmicpc.net 해결방법 입력은 몸무게(w), 키(h) 순이며 w / (h * h)로 bmi를 구해 조건에 따라 출력한다. 코드 #inc.. 2023. 5. 14. [C++] 백준 25784: Easy-to-Solve Expressions 문제 https://www.acmicpc.net/problem/25784 25784번: Easy-to-Solve Expressions When one looks at a set of numbers, one usually wonders if there is a relationship among them? This task is more manageable if there are only three numbers. Given three distinct positive integers, you are to determine how one can be computed using the othe www.acmicpc.net 해결방법 세 수를 배열에 넣어 정렬한 뒤, 첫번째 수와 두번째 수를 더하거나 곱한 게 세번.. 2023. 5. 13. [C++] 백준 6887: Squares 문제 https://www.acmicpc.net/problem/6887 6887번: Squares Gigi likes to play with squares. She has a collection of equal-sized square tiles. Gigi wants to arrange some or all of her tiles on a table to form a solid square. What is the side length of the largest possible square that Gigi can build? For example, wh www.acmicpc.net 해결방법 입력받은 숫자를 sqrt 함수를 이용하여 제곱근을 구하고 앞에 (int)를 붙여 정수로 만들어 출력하면 된다. 코드 .. 2023. 5. 12. 백준 18698: The Walking Adam 문제 https://www.acmicpc.net/problem/18698 18698번: The Walking Adam Adam has just started learning how to walk (with some help from his brother Omar), and he falls down a lot. In order to balance himself, he raises his hands up in the air (that’s a true story), and once he puts his hands down, he falls. You are given a s www.acmicpc.net 해결방법 for문으로 입력받은 문자열을 하나씩 보면서 'D'이기 전까지 U의 개수를 세준다. 코드 #inclu.. 2023. 5. 11. [C++] 백준 5300: Fill the Rowboats! 문제 https://www.acmicpc.net/problem/5300 5300번: Fill the Rowboats! The output will be the number of each pirate separated by spaces, with the word ”Go!” after every 6th pirate, and after the last pirate. www.acmicpc.net 해결방법 1. 1~n까지 숫자를 출력하되 6의 배수일 때마다 "Go!"를 출력한다. 2. n 출력 후 "Go!"를 출력해야 하는데 이 때 n이 6의 배수라면 for문에서의 "Go!" 출력과 중복되므로 출력하지 않는다. 코드 #include using namespace std; int main() { ios_base::s.. 2023. 5. 10. 이전 1 2 3 4 5 6 7 ··· 9 다음