백준일지70 [프로그래머스] 광고 삽입 - sliding window //#include #define fastio cin.tie(0)->sync_with_stdio(0)using namespace std;int arr[360010]; // 최대 재생 시간int time_to_sec(string time){ int h=stoi(time.substr(0,2)); //인덱스 0부터 2글자 뗴오기 int m=stoi(time.substr(3,2)); int s=stoi(time.substr(6,2)); return 3600*h+60*m+s;}string time_tostring(int t){ string ret=""; int h=t/3600; t%=3600; int m=t/60; int s=t%60; ret += h>=10.. 2025. 4. 27. [프로그래머스] 기둥과 보 설치 #include #define fastio cin.tie(0)->sync_with_stdio(0)using namespace std;vector>> Map;bool check(int x, int y, int a){ if(a==0){ // 기둥 if(!y // 바닥위 || (y-1>=0 && Map[0][x][y-1]) //다른 기둥 위 || Map[1][x][y] //보의 오른쪽 끝 위 || (x-1>=0 && Map[1][x-1][y])) //보의 왼쪽 끝 위 return true; } else{ if((y-1>=0 && Map[0][x][y-1]) // 왼쪽 끝 아래가 기둥 .. 2025. 4. 25. [프로그래머스] 표편집 string solution(int n, int k, vector cmd){ vector prev(n), next(n); stack removed; for(int i=0; i1) value = stoi(s.substr(2)); if(command == 'U'){ while(value--){ cur=prev[cur]; } } else if(command == 'D'){ while(value--){ cur=next[cur]; } } else if(command == 'C'){ removed.push(cur.. 2025. 4. 25. [프로그래머스] 유연근무제 int solution(vector schedules, vector> timelogs, int startday) { int answer = 0; for(int i = 0; i goal){ check = 0; break; } } start++; } if(check){ answer++; } } return answer;}[참고]https://velog.io/@yeona/CPS-%EC%9C%A0%EC%97%B0%EA%B7%BC%EB%AC%B4%EC%A0%9C 2025. 4. 22. 이전 1 2 3 4 ··· 18 다음