본문 바로가기
반응형

문제 해결/BaekJoon126

[백준] [C++] 14038번 Tournament Selection https://www.acmicpc.net/problem/14038 14038번: Tournament Selection The output will be either 1, 2, 3 (to indicate which Group the player should be placed in) or -1 (to indicate the player has been eliminated). www.acmicpc.net 코드 #include using namespace std; int main() { int wincount = 0; char input; for (int i = 0; i > input; if (input == 'W') { wincount = wincount + 1; } } swi.. 2022. 11. 18.
[백준] [C++] 13752번 히스토그램 https://www.acmicpc.net/problem/13752 13752번: 히스토그램 히스토그램은 데이터를 시각적으로 표현한 것이다. 막대로 구성되며 각 막대의 길이는 데이터 양의 크기를 나타낸다. 일부 데이터가 주어지면 히스토그램을 생성하시오. www.acmicpc.net 코드 #include using namespace std; int main() { int n, a; cin >> n; for (int i = 0; i > a; for (int j = 0; j < a; j++) { cout 2022. 11. 18.
[백준] [C++] 11654번 아스키 코드 https://www.acmicpc.net/problem/11654 11654번: 아스키 코드 알파벳 소문자, 대문자, 숫자 0-9중 하나가 주어졌을 때, 주어진 글자의 아스키 코드값을 출력하는 프로그램을 작성하시오. www.acmicpc.net 코드 #include using namespace std; int main() { char input; cin >> input; int output = int(input); cout 2022. 11. 18.
[백준] [C++] 11367번 Report Card Time https://www.acmicpc.net/problem/11367 11367번: Report Card Time The input will begin with a single line containing just a whole number, n, of the number of hobbits in the class, followed by n lines in the form a b, where a is the hobbit’s name (only alphabetical characters) and b is the hobbit’s grade, given as a w www.acmicpc.net 코드 #include using namespace std; int main() { int n, score; string.. 2022. 11. 18.
[백준] [C++] 11319번 Count Me In https://www.acmicpc.net/problem/11319 11319번: Count Me In For each sentence, output the number of consonants and vowels on a line, separated by space. www.acmicpc.net 코드 #include #include using namespace std; int main() { string input; int n; cin >> n; getchar(); for (int i = 0; i < n; i++) { getline(cin, input); int vow = 0, con = 0; for (int j = 0; j < input.size(); j++) { switch(input[j]) { c.. 2022. 11. 17.
[백준] [C++] 11104번 Fridge of your Dreams https://www.acmicpc.net/problem/11104 11104번: Fridge of Your Dreams Eirik drinks a lot of Bingo Cola to help him program faster, and over the years he has burned many unnecessary calories walking all the way to the kitchen to get some. To avoid this he has just bought a small fridge, which is beautifully placed next to his www.acmicpc.net 코드 #include #include using namespace std; int main() { in.. 2022. 11. 17.
[백준] [C++] 10926번 ??! https://www.acmicpc.net/problem/10926 10926번: ??! 준하는 사이트에 회원가입을 하다가 joonas라는 아이디가 이미 존재하는 것을 보고 놀랐다. 준하는 놀람을 ??!로 표현한다. 준하가 가입하려고 하는 사이트에 이미 존재하는 아이디가 주어졌을 때 www.acmicpc.net 코드 #include using namespace std; int main() { string a; cin >> a; cout 2022. 11. 17.
[백준] [C++] 10817번 세 수 https://www.acmicpc.net/problem/10817 10817번: 세 수 첫째 줄에 세 정수 A, B, C가 공백으로 구분되어 주어진다. (1 ≤ A, B, C ≤ 100) www.acmicpc.net 코드 #include #include using namespace std; int main() { int a[3], mid; for (int i = 0; i > a[i]; } sort(a, a + 3); mid = a[1]; cout 2022. 11. 16.
[백준] [C++] 10699번 오늘 날짜 https://www.acmicpc.net/problem/10699 10699번: 오늘 날짜 서울의 오늘 날짜를 출력하는 프로그램을 작성하시오. www.acmicpc.net 코드 #include #include int main() { time_t timer = time(NULL); struct tm* t = localtime(&timer); printf("%d-%d-%d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday); return 0; } 풀이 오늘 날짜를 출력하는 문제이다. c++에서 time과 관련된 함수는 #include 을 통해 사용할 수 있다. time 함수를 사용하여 time_t 자료 형태로 현재 시간 결과를 반환한다. 이때 현재 시간은 1970년 1월 .. 2022. 11. 16.
[백준] [C++] 10093번 숫자 https://www.acmicpc.net/problem/10093 10093번: 숫자 두 양의 정수가 주어졌을 때, 두 수 사이에 있는 정수를 모두 출력하는 프로그램을 작성하시오. www.acmicpc.net 코드 #include #include using namespace std; int main() { long long a, b; cin >> a >> b; if (a > b) { swap(a, b); } if (a == b) { cout 2022. 11. 14.
[백준] [C++] 9713번 Sum of Odd Sequence https://www.acmicpc.net/problem/9713 9713번: Sum of Odd Sequence First line of the input contains T, the number of test cases. Each test case contains a single integer N. N is between 1 and 100. www.acmicpc.net 코드 #include using namespace std; int main() { int n, a; cin >> n; for (int i = 0; i > a; int sum = 0; for (int j = 1; j 2022. 11. 14.
[백준] [C++] 9654번 나부 함대 데이터 https://www.acmicpc.net/problem/9654 9654번: 나부 함대 데이터 나부 행성의 함대의 정보를 아래와 예제 출력과 같은 표로 출력한다. 처음 두 열의 너비는 문자 15개, 세 번째 열은 11개, 마지막 열의 너비는 10개이다. www.acmicpc.net 코드 #include using namespace std; int main() { cout 2022. 11. 14.
반응형