일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 백준
- c++ #boj #
- hcpc
- 최소 #공배수 #최대 #공약수 #유클리드 #호제법 #lcm #gcd #c++ #boj #3343 #백준 #장미
- 이분탐색 #dp #11053
- 3D #Reconstruction #computer #vision #volume #metric #tsdf #kinect #fusion
- N번째큰수
- LIS #가장긴증가하는부분수열 #
- 쌤쌤쌤
- 코딩
- 16202
- C++
- 진법변환 #2to10 #10to2 #이진법 #십진법 #변환 #bitset #c++
- BOJ
- graph #최단경로
- 1174
- 20117
- 백준 #다익스트라 #dijkstra #9370 #c++
- boj #백준
- graph
- 투포인터 #백준 #boj #20922 #22862
- 22869
- 사이클 없는 그래프
- backtracking #codetree #디버깅 #삼성코테
- 30870
- c++ #입출력 #속도 #ios #sync_with_stdio #cin #cout #tie
- 3343
- 레드아보
- 호반우 상인
- 줄어드는수
- Today
- Total
목록알고리즘 연습 (105)
hyunjin

백준 다이얼 바로가기 [첫 번째 풀이 방법] - 가장 쉽게 A-Z 까지의 switch 문을 사용해서 풀었다. - C++의 stream을 안쓰고 C의 stream을 사용하려고 노력했으나 왜 컴파일 오류가 나는지 모르겠다. 찾기 싫다. 결론적으로 틀린 곳을 못찾고 그냥 지워버렸다. [두 번째 풀이] #include #include using namespace std; int main(void){ string dial; cin >> dial; int res = 0; for (char c : dial) { int num = (int)c - 'A'; if (num >= 18) num--; if (num >= 23) num--; res = res + num/3+3; } cout

백준/문자열/단어공부(1157) 바로가기 [문제 요약] 대소문자가 섞인 단어(1,000,000이하의 길이)가 주어질 때 가장 많이 사용된 알파벳을 대문자로 출력 가장 많이 사용된 알파벳이 여러 개 존재하는 경우엔 ?를 출력 [첫 번째 풀이] 틀림 #include #include #include #include #include #include #define endl "\n" #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS using namespace std; int main(void){ string word; string res=""; unordered_map hm; cin >> word; //getline(cin, word); //scanf("%s", word);..

백준/함수/한수(1065) 문제 바로 가기 [간단 문제 설명] 자연수의 각 자리가 등차 수열을 이룰 때 그 수를 한수라 한다. 자연수 N(= 10) { int d2 = (num%100)/10 - num % 10; num /= 10; if (d1 != d2) return false; d1 = d2; } return true; } int main(void) { int N = 0,res=0; cin >> N; for (int i = 1; i N; } void Solution() { int Ans = 0; if (N
백준/정수N개의 합(15596) 간단 문제 설명 정수 n개가 주어졌을 때, n개의 합을 구하는 함수를 작성해라 c++의 경우 : long long sum(vector &a) 첫 번째 풀이 #include using namespace std; long long sum(vector &a) { long long answer = 0; for (auto elem : a) answer += elem; return answer; } 풀이 전략 for문으로 더한다. 다른 사람 풀이도 비슷하다. 배열, 반복자 등으로 풀면 된다. 궁금한 점 함수의 인자를 void solution(vector a) {} 로 주면 컴파일 에러가 난다. why?? 알게 된 점 void solution(vector &v1, string s1)..

백준/1차원배열/나머지 문제 간단 설명 10개의 수를 입력 받고 해당 수들을 42로 나눈 나머지를 구한다. 그 다음 서로 다른 값이 몇 개 인지 출력하는 문제 첫 번째 풀이 : map 사용 #include #include using namespace std; int main(void) { map m; int result = 0; for (int i = 0; i > num; if (m.count(num % 42) == 0) { m.insert(make_pair(num%42,1)); result++; } } cout num; if (nums[num%42]==0) { nums[num % 42]++; result++; } } cout num; if (!nums..
https://www.acmicpc.net/problem/2748 정수 n(단, n>=2)이 주어지면 n번째 피보나치 수열 값을 구하는 문제다. 첫 번째 풀이 -> 틀림 #include using namespace std; int Fibonacci(int n); int main(void) { int n; cin >> n; cout
https://programmers.co.kr/learn/courses/30/lessons/42842 첫 번째 방법 #include #include using namespace std; vector solution(int brown, int yellow) { vector answer; int br = (brown +4)/2; for(int y = 3,x= br-y; y =3; y++){ x = br-y; if( (y-2)* (x-2) == yellow){ answer.push_back(x); answer.push_back(y); break; } } return answer; } 풀이 방법 문제의 제한 사항을 보니 brown의 범위가 yellow 보다 작아서 brown 기준으로 문제를 풀..
https://programmers.co.kr/learn/courses/30/lessons/60057 첫 번째 풀이 #include #include #include #include using namespace std; int solution(string s) { int answer = s.length(); stack stack1; stack stack2; string unit; int cnt=0; for(int i = 1 ; i < s.length()/2+1 ;i++){ for(int j = 0; j