목록Algorithm (154)
cgy12306
// https://www.acmicpc.net/problem/11652 // 카드 #include #include #include #include using namespace std; long long num; int N; bool cmp(pair &a, pair &b) { if (a.second == b.second) return a.first b.second; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> N; unordered_map um; for (int i = 0; i > num; um[num]++; } vecto..
// https://www.acmicpc.net/problem/10825 // 국영수 #include #include #include #include using namespace std; typedef struct student{ string name; int kor, eng, math; }student; bool cmp(student a, student b) { if (a.kor == b.kor && a.eng == b.eng && a.math == b.math) return a.name b.math; if (a.kor == b.kor) return a.eng < b.eng; return ..
// https://www.acmicpc.net/problem/17404 // RGB거리 2 #include #include using namespace std; int N, arr[1002][1002], dp[1002][1002]; const int INF = 999999999; int main() { cin >> N; for (int i = 1; i arr[i][j]; } } int Min = INF; for (int rgb = 1; rgb
// https://www.acmicpc.net/problem/1149 // RGB거리 #include #include using namespace std; int arr[1002][1002], dp[1002][1002]; int N; int main() { cin >> N; for (int i = 1; i arr[i][j]; } } dp[1][1] = arr[1][1]; dp[1][2] = arr[1][2]; dp[1][3] = arr[1][3]; for (int i = 2; i
// https://www.acmicpc.net/problem/14002 // 가장 긴 증가하는 부분 수열 4 #include #include #include int dp[1000002]; int arr[1000002]; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); vector v; int N; cin >> N; for (int i = 1; i > arr[i]; } dp[1] = 1; for (int i = 2; i arr[j]) dp[i] = max(dp[i], dp[j]); } dp[i]++; } int Max = 0, MaxIdx; for (int i = 1; i Max) { ..
// https://www.acmicpc.net/problem/1904 // 01타일 #include using namespace std; int dp[1000002]; const int MOD = 15746; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int N; cin >> N; dp[1] = 1; dp[2] = 2; for (int i = 3; i
// https://www.acmicpc.net/problem/15990 // 1, 2, 3 더하기 5 #include #include using namespace std; long long dp[100002][4]; const int MOD = 1000000009; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int T; cin >> T; for (int t = 0; t > N; dp[1][1] = 1; dp[2][2] = 1; dp[3][1] = 1; dp[3][2] = 1; dp[3][3] = 1; for (int i = 4; i
// https://www.acmicpc.net/problem/1965 // 상자넣기 #include #include using namespace std; int box[1002], dp[1002]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int N; cin >> N; for (int i = 1; i > box[i]; } dp[1] = 1; for (int i = 2; i box[j]) dp[i] = max(dp[i], dp[j]); } dp[i]++; } int Max = 0; for (int i = 1; i