본문 바로가기

반응형

코딩 이야기

(100)
백준 1926번: 그림 C++코드(BFS) #include #include #include #include #include using namespace std; int n,m; int picture[501][501]; int visit[501][501] = {0,}; int x[4] = {0,0,1,-1}; int y[4] = {1,-1,0,0}; int bfs(int s1, int s2){ int funcnt = 0; queue q; q.push(make_pair(s1,s2)); while(!q.empty()){ funcnt += 1; pair now = q.front(); q.pop(); for(int i=0; i> m; vector v; v.push_back(0); for(int i=0; i picture[i][j]; } } for(int ..
백준 2193번: 이친구 C++코드(DP, 다이나믹 프로그래밍) #include using namespace std; long long arr[100] = {0,}; long long dp(int n){ if(n n; arr[1] = 1; arr[2] = 1; cout
백준 1181번: 단어 정렬 C++코드(정렬) #include #include #include #include #include using namespace std; bool cmp(const string & a, const string & b){ if(a.length() < b.length()) return true; else if(a.length() == b.length()){ if(a < b) return true; } return false; } int main(){ int n; char temp[51]; vector words; scanf("%d", &n); for(int i=0; i
백준 3046번: R2 C언어 코드(구현, 사칙연산) #include int main(){ int r1, s; scanf("%d %d", &r1, &s); printf("%d", s+(s-r1)); } 설명 S가 평균이므로 S에 S와 R1의 차이만큼 더해주면 R2가 나온다. 문제점 없다.
백준 1932번: 정수 삼각형 C++코드(DP, 다이나믹 프로그래밍) #include #include using namespace std; int arr[501][501]; int cost[501][501] = {0,}; int n; void dp(){ for(int i=0; i
백준 11758번: CCW C++코드(기하학) #include using namespace std; int just(int x1, int x2, int x3, int y1, int y2, int y3){ int temp = (x2-x1)*(y3-y1) - (y2-y1)*(x3-x1); temp = temp/2; if(temp > 0){ return 1; }else if(temp == 0){ return 0; }else if(temp > x1 >> y1 >> x2 >> y2 >> x3 >> y3; cout
2021 국민대학교 알고리즘 대회 후기 오늘 국민대 알고리즘 대회에 참가하였다. 필자는 좋은 점수를 받은게 아니기 때문에 말은 길게 못하겠다. 두 문제를 각각 50점씩 맞아서 총 100점을 마무리했다.(200점 만점) 참가할 때부터 상을 받는 것을 목표로 하는게 아닌 단순히 대회 경험을 한번 해보면 좋겠다싶어서 참여했기 때문에, 그냥저냥이다. 매번 백준을 풀 때 문제 알고리즘 유형을 알고 풀다가 그냥 생판 문제를 보고 풀려니 알고리즘을 무엇을 사용해야하는 지 헷갈렸다. 문제 알고리즘을 유추하는 연습을 하면 좋을 것 같다. 아무튼 좋은 경험이였다.
백준 11650번: 좌표 정렬하기 C++코드(정렬) #include #include #include #include using namespace std; int main(){ int n; int temp, temp2; vector arr; scanf("%d", &n); for(int i=0; i

반응형