Skip to content

Instantly share code, notes, and snippets.

View MapoCodingPark's full-sized avatar

Woong MapoCodingPark

View GitHub Profile
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1000005;
ll mini, maxi;
bool visited[MAX];
int main() {ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);
@MapoCodingPark
MapoCodingPark / BOJ 6086.cpp
Created July 11, 2020 14:26
백준 문제풀이
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
const int MAX_V = 52; // 알파벳 대,소문자 총 52 개
const int INF = 1000000000;
// 알파벳 -> 숫자 변환
int CtoI(char c) {
// index: 대문자 = 0~25 , 소문자 = 26~51
@MapoCodingPark
MapoCodingPark / BOJ 2662.cpp
Created July 1, 2020 11:02
백준 문제풀이
#include <bits/stdc++.h>
using namespace std;
int N, M;
// company[x][k] : x 회사에 k원 투자할 때 얻는 가치
int company[22][333];
// dp[x][k] : x 까지 회사에서 k원으로 얻을 수 있는 최대 가치
int dp[22][333];
// 각 기업 투자 액수 추적할 배열
// path[x][k] : dp[x][k]를 최대로 만드는 x에서 투자한 금액
@MapoCodingPark
MapoCodingPark / BOJ 1660.cpp
Created July 1, 2020 10:26
백준 문제풀이
#include <bits/stdc++.h>
using namespace std;
const int MAX = 200;
int N;
// triangle[k] : 사이즈 k 인 사면체 만들 때 필요한 대포알 수
// MAX=200 : 200개 정도 잡아놓으면 3*10^5 보다 한참 크다
int triangle[MAX];
// dp[x] : x 개의 대포알로 만드는 최소 사면체 개수
int dp[300005];
@MapoCodingPark
MapoCodingPark / BOJ 2410.cpp
Created July 1, 2020 10:18
백준 문제풀이
#include <bits/stdc++.h>
using namespace std;
// 오름차순 으로 더해져야 한다고 생각
// 즉 1+2+4 = 1+4+2
typedef long long ll;
const ll MOD = 1000000000;
const int MAX = 1000005;
int N;
// dp[x][k] : x 수, 2^k 로 끝나는 멱수의 합 개수
@MapoCodingPark
MapoCodingPark / BOJ 9184.cpp
Created July 1, 2020 10:04
백준 문제풀이
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
// dp[x][y][z] : a=x, b=y, c=z 인 상태에서의 함수 값
int dp[55][55][55];
int DP(int x, int y, int z) {
if (x <= 0 || y <= 0 || z <= 0) return 1;
@MapoCodingPark
MapoCodingPark / BOJ 1695.cpp
Created July 1, 2020 08:47
백준 문제풀이
#include <bits/stdc++.h>
using namespace std;
const int MAX = 5005;
int N;
int arr[MAX];
// dp[i][j] : i,j 를 양 끝으로 하는 펠린드롬 만드는 데 필요한 최소 개수
int dp[MAX][MAX];
int palin(int s, int e) {
@MapoCodingPark
MapoCodingPark / BOJ 16500.cpp
Created June 27, 2020 12:32
백준 문제풀이
#include <bits/stdc++.h>
using namespace std;
string S;
int N;
vector<string> arr[26]; // S[t] : 글자 t 로 끝나는 단어들
bool dp[111]; // dp[x] : x ~ 끝까지 채울 수 있는지 여부
int main() {ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);
@MapoCodingPark
MapoCodingPark / BOJ 2832.cpp
Created June 22, 2020 11:04
백준 문제풀이
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 100005;
int N;
int arr[MAX];
ll R; // 정답
void Rev() { // 투 포인터
@MapoCodingPark
MapoCodingPark / BOJ 4343.cpp
Created June 22, 2020 10:16
백준 문제풀이
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
// tp< 거리, 노드 번호, 노드 번호 >
typedef tuple<double, int, int> tp;
int N, S, P;
pii arr[555];
double dist(pii a, pii b) {