백준 1029번 그림 [C++코드]
우선 나는 BFS를 활용해서 풀었다. 입력값을 담은 뒤 방문이력, 입력값이 1인지, 범위 내인지를 확인하면서 상하좌우 움직이면서 확인하는 함수를 돌렸다. #include #include #include #define X first #define Y second using namespace std; int MAX=0; int counting=0; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int n, m; int check(int x, int y); int visit[500][500]={0,}; int paint[500][500]={0,}; int main(void){ ios::sync_with_stdio(0); cin.tie(0); cin>>n>>m; // vector..
2021. 5. 7.
[Pandas] 데이터 프레임 사용법 2
Pandas- Select, Filter Rows or Columns import pandas as pd friend_list=[ ['name',['john','jenny','nate']], ['age',[23,34,12]], ['job',['student','developer','teacher']] ] df=pd.DataFrame.from_dict(dict(friend_list)) 데이터프레임에서 원하는 row만 잘라내는 법(연결된 부분) column condition에 따라 row를 선택 위와 같이 df에 따로 초기화를 시켜주지않으면 본래의 값은 변하지 않는다. Filter Column by index by column name Row, Column 삭제하기 #다시 데이터프레임 세팅 import pa..
2021. 5. 3.