목록백준 (42)
Deep Learning study
#include using namespace std; #define max(a,b) a>b ? a : b int n,L[21],J[21]; int dp[21][101]; int go(int a, int b){ if(dp[a][b]) return dp[a][b]; if(a>=n) return 0; dp[a][b] = b-L[a]>0 ? max(go(a+1,b-L[a])+J[a],go(a+1,b)) : max(dp[a][b],go(a+1,b)); return dp[a][b]; } int main(){ cin >> n; for(int i=0 ;i> L[i]; for(int i=0 ;i> J[i]; cout
#include using namespace std; #define inf 1000000000 long long int d[101][10]; long long int dlclstn(int n,int i){ if(n> n; for(int i=1 ; i
#include #include using namespace std; int n,k; int r[1001]; bool visited[1001]; int dfs(int i,int dep){//깊이 탐색. 연결고리 탐색. if(!visited[r[i]]){ visited[r[i]] = true; return dfs(r[i],dep+1); } else return dep; } int dfs2(int i,int dep){//깊이 탐색. 연결고리 탐색. int k=0; if(!visited[r[i]]){ visited[r[i]] = true; k = dfs(r[i],dep+1); visited[r[i]] = false; } else return dep; return k; } int ks(int i,int sum)..
#include #include using namespace std; long long int m,M; bool check[5000001]; int main(){ cin >> m >> M; int cnt=0; for(long long int i=2 ; i*i
#include #include #include #include using namespace std; #define ll long long #define INF 1e9+7 int main(){ ios_base::sync_with_stdio(0); int t; cin >> t; while(t--){ int lim,n; ll ans=INF; vector a[4],s[2]; cin >> lim >> n; for(int i=0 ;i
#include #include #include using namespace std; char a[1000001]; bool erased[1000001]; char b[100]; int main() { scanf("%s",a); scanf("%s",b); int n = strlen(a); int m = strlen(b); if (m == 1) { for (int i=0; i
#include #include using namespace std; bool ck[5000][5000]; void tristar(int now) { for (int i = now + 1; i n; ck[1][1]= ck[2][1] = ck[3][1] = ck[2][3] = ck[3][2] = ck[3][3] = ck[3][4] = ck[3][5] = true; for (int k = 3; k < n; k *= 2) tristar(k); for (int i = 1; i