목록 Categories (93)
Deep Learning study
#include using namespace std; #define endl '\n' int main(){ ios_base::sync_with_stdio(false); stack stc; int N; string s; cin >> N; for(int i=0 ; i> s; if(s == "pop"){ if(stc.empty()) cout
#include using namespace std; #define pb push_back int N,M; int X[4] = {0,0,1,-1}; int Y[4] = {1,-1,0,0}; int dfs(int x, int y,int arr[][11]){ int ret = 1; for(int i = 0; i = 1 && nextX 0 && nextY > N >> M; for(int i = 1 ; i arr[i][j]; if( arr[i][j] == 2) posV.pb(make_pair(i,j)); else if(arr[i][j] == 0) posZ.pb(make_pair(i,j)); else one..
#include #include #include #include using namespace std; vector v[10001]; int visited[10001]; int finished[10001]; bool dfs(int x){ bool flag = true; visited[x] = 1; for(int nx : v[x]){ if(!visited[nx]) flag = dfs(nx); if(flag == false) break; else if(finished[nx] == 0) return false; } finished[x] = 1; return flag; } int main(){ ios_base::sync_with_stdio(0); int n; cin >> n; map m; for(int i=0 ;..
#include #include using namespace std; struct cost { int a, b; int c; bool operator c; } }cost[100001]; int parent[10001]; long long int sum; int set_find(int); void set_union(int, int,int); int main() { ios_base::sync_with_stdio(false); long long int v, e; cin >> v >> e; for (int i = 1; i cost[i].a >> cost[i].b >> cost[i].c; sort(cost + 1, cost + 1 + e); for (int i = 1; i
#include #include using namespace std; int dx[4] = {0,0,1,-1}; int dy[4] = {1,-1,0,0}; int g[100][100]; int d[100][100]; int main(){ int n,m; scanf("%d %d",&m,&n); for(int i=0 ;i
#include #include #include using namespace std; int main(){ string s; cin >> s; int n = s.length(); vector num; int start,temp=0,index; int ans=0; for(int i=0 ;i
#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