목록Computer/Coding Test (70)
Machineboy空
예제 7. 직사각형 방의 면적 조건)1feet = 0.3048m출력)What is the length of the room in feet? 15What is the width of the room in feet? 20You entered dimensions of 15 feet by 20 feetThe area is300 squre feet22.871 square meters#include #include using namespace std;int length, width;int main() { cout > length; cout > width; cout 예제 8. 피자 파티출력 예)How many people? 8How many pizzas do you have? 2How many pie..
예제 1. 인사하기출력 예)What is your name? BrianHello, Brian, nice to meet you!#include using namespace std;string input;int main() { cout > input; cout 예제 2. 글자 수 세기출력 예)What is the input string? HomerHomer has 5 characters.#include using namespace std;string input;int main() { cout > input; string num = to_string(input.length()); cout 예제 3. 따옴표 출력출력 예)What is the quote? These aren't the ..
https://www.acmicpc.net/problem/1717 문제요약0 a b : a가 포함되어 있는 집합과, b가 포함되어 있는 집합을 합친다.1 a b : 두 원소가 같은 집합에 포함되어 있는지를 확인한다.난이도Gold 5풀이 포인트Union-Find TreeREVIEW DP를 썼다고 함. 무슨 소린지 아직 파악 전.CODE// 코테 통과는 백트래킹까지만 알면되고! 유니온 파인드 부터는 킬러 문항으로 나옴!// Union은 합집합, Find: 그룹의 대표찾기!// DP기법의 두 가지 기법 중 하나로, 메모리자이제이션?#include using namespace std;int n, m;int par[1000001];// 0: 합집합, 1: Find // 대표를 리턴하는 연산void init(){ ..
https://www.acmicpc.net/problem/15649 문제요약1부터 N까지 자연수 중에서 중복 없이 M개를 고른 수열을 출력하라! 난이도Silver 3풀이 포인트백트래킹REVIEW 백트래킹은 곧 dfs다.. 아직 무슨 말인지 잘 와닿지 않는다.다시 공부해야한다.CODE// 백트래킹: 뒤로 다시 돌아가서 확인해본다! 역으로 돌아가본다!// 백트래킹을 곧 dfs라고 할 수 있다!#include using namespace std;// 거쳐온 경로vector v;int visited[10];int N,M;// 리프노드에 왔는지 체크를 phase ,단계void f(int phase){ if(phase == M){ for(auto it:v){ cout > N>>..
내일 풀 수학 문제의 개수는 오늘 푼 문제 개수의 수와 숫자의 구성이 같으면서, 오늘 푼 문제 개수의 수보다 큰 수 중 가장 작은 수입니다.예를 들어, 오늘 67문제를 풀었으면 다음 날 76문제를 풉니다. 오늘 푼 문제의 개수를 줬을 때 다음날 풀 문제의 개수를 출력하는 프로그램을 작성하세요.입력오늘 푼 문제의 개수 자연수 N1 출력다음날 풀 문제의 개수 출력문제요약입력값과 같은 구성의 수 중 가장 작은 큰 수풀이 포인트Next-permutation정렬REVIEW경우의 수가 다양해지면 자꾸 생각하길 포기한다.작은 단계로 나누어 생각하는 법을 또 명심!999999까지가 아닌 1000까지만 해서 생각해보고 넓히고 하면 됌!CODE#include #include #include using namespace s..
https://www.acmicpc.net/problem/1813문제요약N개의 말 중에 참인 말의 개수를 구하여라. 난이도Silver 5풀이 포인트Ad-Hoc의 규칙을 찾아내는 것!REVIEW경우의 수를 다 따져야 한다고 생각하니 머리가 아팠고, 무언가 예외없는 대단한 규칙을 발견해야만 할 것 같아 부담스러운 문제였는데AdHoc이라는 알고리즘이 있구나!를 새로이 알게 되었다.CODE#include using namespace std;int n, s;int a[51];bool hasT = false;int main(){ cin >> n; for (int i = 0; i > s; a[s]++; } for (int i = 51; i >= 0; i--) { i..
문제 난이도와 출제 범위총 4문제 출제자료구조: queue, vector, pair, map, set 등문자열 다루기: 문자열 자르기, 숫자 변환 등기존 라이브러리 위주 활용dfs, bfs 최단거리,경우의 수 등의 알고리즘 문제는 나오지 않았음.기본 자료구조와 문법을 숙지하니? 정도의 테스트였다.시험 환경모니토 앱 이용 원격 감시다중 모니터 사용 불가노트북 + 마우스, 키보드 연결 허용빈 종이 1장과 펜 허용(노트 불가)기존 프로그래머스 문제 에디터처럼 입출력 폼까지는 제공앞으로의 공부 방향일단 너무 기본기가 부족하다는 생각을 했다.c++은 문제풀이용이니까 하면서 소홀히 했던 언어 공부의 한계를 느꼈다. 자료구조별 C R U D 관련 메소드 암기문자열 공백 등 자유자재로 다루기알고리즘을 더 공부할 게 아..
https://www.acmicpc.net/problem/14469문제요약도착한 시간과, 검문 시간이 주어질 때 모든 소가 출입하는데 걸리는 최소 시간. 난이도Silver 4풀이 포인트max그리디REVIEW바로 맞아버려서 의아했다.하지만 모범 풀이에서 다음 소가 도착한 시간과, 이전 소가 점검을 마친 시간 사이에 간극이 있을 때,시간을 갱신해주는 로직과, 시간 경과를 더해주는 과정이 훨씬 간결하다. 배워두기. 또 따로 int형에 숫자를 받아 pair에 넣는 방식이 아니라 바로 pair요소에 집어넣는 것도 훨씬 간결해보인다. CODE// Mine#include using namespace std;int t,a,b;vector> v;int crtT;int main(){ cin >> t; for(i..