행/열에 대한 합을 저장하는 (col, row) 배열과. 증가대각선,감소대각선에 대한 합을 저장하는 변수(Adddiagonal/Minusdiagonal)를 미리 선언했습니다. - 2중 for문을 통해 수를 입력받으면서 해당 행/열의 합, 대각선의 합에 값을 더해줍니다. - 입력이 끝난 후 배열과 변수에 저장된 값 중 가장 큰 값이 답이 됩니다. C++ 소스 코드 #include #include using namespace std; int col[100],row[100],Adddiagonal,Minusdiagonal; int main(){ int t,num; for(int tc = 1;tc> t; for(int i=0;i num; col[j]+=num; row[i]+=num; if (i==j) { Addd..
입력받은 2차원 배열 전체를 돌면서, 모든 (i,j) 쌍에서 가능한 회문의 최대 길이를 구하면 그 중 최대값이 답이 됩니다. C++ 소스 코드 #include #include #define MAX 100 using namespace std; string map[MAX]; int check(int x, int y){ for(int k=MAX;k>=2;k--){ int width = k,height = k; for(int t = 0;t 1) return height; } return 1; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tc; for(int test_case = 1; test_case> tc; int ans =..
https://www.acmicpc.net/problem/5427 5427번: 불 문제 상근이는 빈 공간과 벽으로 이루어진 건물에 갇혀있다. 건물의 일부에는 불이 났고, 상근이는 출구를 향해 뛰고 있다. 매 초마다, 불은 동서남북 방향으로 인접한 빈 공간으로 퍼져나간다. www.acmicpc.net Queue를 두개 사용한 BFS로 구현하였습니다. C++ 소스 코드 #include #include using namespace std; char b[1002][1002]; queue fire; queue pos; int n, h, w, si, sj, ex, ey; int visit[1002][1002]; const int dx[]= {0,0,-1,1}, dy[] = {-1,1,0,0}; void bfs(){..
https://programmers.co.kr/learn/courses/30/lessons/1844 코딩테스트 연습 - 게임 맵 최단거리 [[1,0,1,1,1],[1,0,1,0,1],[1,0,1,1,1],[1,1,1,0,1],[0,0,0,0,1]] 11 [[1,0,1,1,1],[1,0,1,0,1],[1,0,1,1,1],[1,1,1,0,0],[0,0,0,0,1]] -1 programmers.co.kr BFS로 풀이하였습니다. C++ 소스 코드 #include #include using namespace std; const int dx[] = {0,0,-1,1}, dy[]={-1,1,0,0}; int dist[101][101]; int solution(vector maps){ dist[0][0]= 1; in..
https://www.acmicpc.net/problem/1966 1966번: 프린터 큐 문제 여러분도 알다시피 여러분의 프린터 기기는 여러분이 인쇄하고자 하는 문서를 인쇄 명령을 받은 ‘순서대로’, 즉 먼저 요청된 것을 먼저 인쇄한다. 여러 개의 문서가 쌓인다면 Queue 자료�� www.acmicpc.net priority_queue와 queue를 사용해서 풀이하였습니다. C++ 소스 코드 #include #include using namespace std; int main(){ int prior[101]; queue q; priority_queue pq; int tc; cin >> tc; while(tc--){ while (!q.empty()) q.pop(); while (!pq.empty()) p..
https://www.acmicpc.net/problem/4949 4949번: 균형잡힌 세상 문제 세계는 균형이 잘 잡혀있어야 한다. 양과 음, 빛과 어둠 그리고 왼쪽 괄호와 오른쪽 괄호처럼 말이다. 정민이의 임무는 어떤 문자열이 주어졌을 때, 괄호들의 균형이 잘 맞춰져 있는지 판단 www.acmicpc.net stack을 이용해서 풀이하였습니다. C++ 소스 코드 #include #include #include using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); bool ck; stack st; string str; while(true){ str=""; while(!st.empty()) st.pop..
https://www.acmicpc.net/problem/9375 9375번: 패션왕 신해빈 문제 해빈이는 패션에 매우 민감해서 한번 입었던 옷들의 조합을 절대 다시 입지 않는다. 예를 들어 오늘 해빈이가 안경, 코트, 상의, 신발을 입었다면, 다음날은 바지를 추가로 입거나 안경대신 www.acmicpc.net C++ 소스 코드 #include #include #include #include using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); map mp; set st; int tc,n,ans; cin >> tc; while(tc--){ mp.clear(); st.clear(); ans = 1; ci..
https://programmers.co.kr/learn/courses/30/lessons/49994 코딩테스트 연습 - 방문 길이 programmers.co.kr 배열을 사용해 방문 좌표를 확인할 수 있도록 범위를 (0,0)~ (10,10)으로 조정하였습니다. 이 문제에서 '길'은 (x, y) -> (u, v) 사이입니다. 처음 문제에 접근할 때 '걸어본 길'을 '방문한 칸'으로 해석해 해멨습니다.ㅠㅠ 때문에 (x,y)에서 (u,v)로 왔다면, 역방향도 같은 길이기 때문에 visit[x][y][u][v] , visit[u][v][x][y] 을 모두 true로 표시해야합니다. C++ 소스 코드 #include using namespace std; bool visit[11][11][11][11]; int ..
- Total
- Today
- Yesterday
- infallible
- UIHostingController
- Swift weak
- rxswift
- 안드로이드
- Lottie
- SWEA
- 프로그래머스
- Swift unowned
- 카카오인턴십
- Reactivex
- ARKit
- DispatchQueue
- 코코아팟
- 백준온라인저지
- cocoapods
- ios
- rxswift6
- blendshapes
- 알고리즘
- GraphDB
- SwiftUI
- coreml
- Kotlin
- 백준
- Swift
- disposeBag
- C++
- blendshape
- boj
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |