본문 바로가기

전체 글

N queen 더보기
15649 N과 M (1) ㅎㅎㅎ... N 퀸 문제... 마스터... 퀸 풀 때 처럼 풀었다. https://burningjeong.tistory.com/174 N queen burningjeong.tistory.com 전에 수업시간에 이렇게 배워서 계속 사골처럼 코드 우려먹는 중.. 퀸이랑 다른 점이라 하면 퀸은 놓을 자리를 확인하고 놓는다면 이 문제는 일단 넣어보고 그 다음 맞는지 확인한다. 확인하는 부분은 배열에 같은 게 있는지 / 없는지를 체크하는데 이걸 깔쌈하게 sort - unique - erase로 하려다가 배열 크기 때문에 그냥 하나씩 확인했다. 만약 위의 방식대로 쓰려면 append로 하나씩 넣어야 하지 않을까? 앗 게다가 기존의 배열 순서도 섞여버리네. 이게 최선인 것 같다. #include #include us.. 더보기
[코드포스 Practice11] 후기 코포 10회까지는 음~ 두문제 해치우고 나머지 열심히 해야지! 이렇게 풀었는데 난이도 [800 - 1000 - 1200 - 1400 - 1600] -> [1200 - 1300 - 1400 - 1500 - 1600] 이렇게 올라서 A번 부터 머리 빡빡 굴리면서 풀었다. 빠ㅏ빠바빨간맛 매운맛 코포였음. 아무튼 풀다가 별별생각이 다 들었는데 처음 코포 풀 때 당황스러운 기억 떠올라서 괜히 추억에 잠겼다. 이제 이정도 난이도인거 아니깐 다음에는 마음 좀 다잡고 풀어야지. A - 14분 X 문제 이해를 못함 B - 16분 C - 14분 X 맞왜틀 D - X 이해는 했는데 풀지를 못하겠음 E - X 문제 읽다 끝남 나름 신경 쓴 건 모르겠으면 넘기기. 20분 기준으로 모르겠으면 다음 문제로 넘어갔다. 잘한 선택인것.. 더보기
[코드포스 Practice10] E. Military Problem (미완) In this problem you will have to help Berland army with organizing their command delivery system. 이 문제에서 너는 Berland 군대의 명령전달 시스템을 구성하는 것을 도와야 할것이다. There are n officers in Berland army. The first officer is the commander of the army, and he does not have any superiors. Every other officer has exactly one direct superior. If officer a is the direct superior of officer b, then we also can say that.. 더보기
[코드포스 Practice10] D. Alice and the List of Presents Alice got many presents these days. So she decided to pack them into boxes and send them to her friends. There are n kinds of presents. Presents of one kind are identical (i.e. there is no way to distinguish two gifts of the same kind). Presents of different kinds are different (i.e. that is, two gifts of different kinds are distinguishable). The number of presents of each kind, that Alice has i.. 더보기
[코드포스 Practice10] C. Video Posts Polycarp took n videos, the duration of the i-th video is ai seconds. The videos are listed in the chronological order, i.e. the 1-st video is the earliest, the 2-nd video is the next, ..., the n-th video is the last. Now Polycarp wants to publish exactly k (1≤k≤n) posts in Instabram. Each video should be a part of a single post. The posts should preserve the chronological order, it means that t.. 더보기
[코드포스 Practice10] B. Mislove Has Lost an Array Mislove had an array a1, a2, ⋯, an of n positive integers, but he has lost it. He only remembers the following facts about it: The number of different numbers in the array is not less than l and is not greater than r; For each array's element ai either ai=1 or ai is even and there is a number ai2 in the array. For example, if n=5, l=2, r=3 then an array could be [1,2,2,4,4] or [1,1,1,1,2]; but i.. 더보기
[코드포스 Practice10] A. Distinct Digits You have two integers l and r. Find an integer x which satisfies the conditions below: l≤x≤r. All digits of x are different. If there are multiple answers, print any of them. Input The first line contains two integers l and r (1≤l≤r≤105). Output If an answer exists, print any of them. Otherwise, print −1. 아 그래 A번ㅋㅋ 이거 풀면서 분명 더 쉽게 풀 수 있을 것 같은데?? 이게 최선인가?? 하면서 풀었음. 풀 줄은 알겠는데... 알겠는데...... 괜찮은 방법이 .. 더보기