'정렬' 태그의 글 목록
본문 바로가기
728x90
반응형

정렬8

2022-04-21-16235-나무재테크 01.봄 실수로 나이를 증가하고 양분을 제거함 void spring() {//봄 양분 흡수 for (int i = 0; i = 0) {//양분 흡수 하는 경우 A[i][j] -= tree[i][j][k]; tree[i][j][k]++; } else{ A_Death[i][j] += tree[i][j][k] / 2;//죽은 나무 영양분 저장 tree[i][j].erase(tree[i][j].begin() .. 2022. 4. 21.
2021.10.07_21609-상어중학교 소스코드1 #include #include #include #include #include #include using namespace std; #define SIZE 21 int N, M,answer; int bnum = 1; int B[SIZE][SIZE]; int visit[SIZE][SIZE] = { 0, }; int raindow, blockCnt; int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; struct Data { int y, x, cnt,num,bnum; }; vectorblock; bool cmp(Data a, Data b) { if (a.cnt == b.cnt) { if (a.num == b.num) { if (a.y == b.y) { ret.. 2021. 10. 8.
프로그래머스 가장 큰 수 programmers.co.kr/learn/courses/30/lessons/42746?language=cpp 코딩테스트 연습 - 가장 큰 수 0 또는 양의 정수가 주어졌을 때, 정수를 이어 붙여 만들 수 있는 가장 큰 수를 알아내 주세요. 예를 들어, 주어진 정수가 [6, 10, 2]라면 [6102, 6210, 1062, 1026, 2610, 2106]를 만들 수 있고, 이중 가장 큰 �� programmers.co.kr #include #include #include #include using namespace std; bool cmp(string a, string b) { return a + b > b + a; //두개를 붙일때 큰 순으로 정렬 } string solution(vector numbe.. 2020. 8. 26.
1181 단어 정렬 https://www.acmicpc.net/problem/1181 1181번: 단어 정렬 첫째 줄에 단어의 개수 N이 주어진다. (1≤N≤20,000) 둘째 줄부터 N개의 줄에 걸쳐 알파벳 소문자로 이루어진 단어가 한 줄에 하나씩 주어진다. 주어지는 문자열의 길이는 50을 넘지 않는다. www.acmicpc.net 여기서는 속도 차이를 보여드리겠습니다. 우선 그전에 두가지 방식을 사용해서 문제 풀이를 하겠습니다 출력할때만 중복없이 출력하는 방법 #include #include #include #include #include using namespace std; bool cmp(const string &u, const string &v) { if (u.size() == v.size())return u < .. 2020. 8. 24.
728x90
반응형