본문 바로가기

분류 전체보기224

백준 14502번 연구소 (C++) 문제정답 코드#include #include #include #include #include #include using namespace std; const int dx[] = {0,1,0,-1}; const int dy[] = {1,0,-1,0}; int n,m; int do_find(vector to_find) {//맵이 고정됐으니까 이제 각 값들에 대해서 안전영역이 몇개인지 찾기. vector vis(n,vector(m,0)); for (int i=0;i < n; i++) { for (int j =0;j < m;j++) { if (to_find[i][j] == 2 && vis[i][j] == 0) { vis[i][j] = 1; queue Q; Q.push({i,j});//y,x while (!Q.e.. 2023. 1. 8.
백준 9012번 괄호 (C++) (스택활용) 문제정답 코드#include #include #include #include using namespace std; int main() { int n; cin >> n; for (int i=0;i > s; for (auto it : s) { if (it == ')') { if (st.empty()) { cout 2023. 1. 8.
백준 1436번 영화감독 숌(C++) 문제 정답 코드 #include using namespace std; #define ll long long int main() { ll n; cin >>n; ll go = 665; int i =0; int tmp; while(i 2023. 1. 7.
백준 2852번 NBA 농구(C++) 문제정답 코드#include #include #include #include using namespace std; string bef_time; string make_ret_time(string ret, string bef,string now) { char arr[6]; arr[0] = now[0] -bef[0] + '0'; arr[1] = now[1] - bef[1] + '0'; arr[2] = ':'; arr[3] = now[3] - bef[3] + '0'; arr[4] = now[4] -bef[4] + '0'; if (arr[4] input_num >> time; if (input_num == 1) first_score++; else second_score++; if (first_score > se.. 2023. 1. 7.
백준 3474번 교수가 된 현우(C++) 문제정답 코드#include #include #include #include using namespace std; int t_n; int f_n; int main() { ios:: sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int a; for(int i = 0; i > a; int ret2 = 0, ret5 = 0; for(int j = 2; j num; arr.push_back(num); backup.push_back(num); } sort(arr.begin(),arr.end()); int num = arr[0]; int tnum = num; while (num) { if (tnum%4 == 0) { t_n.. 2023. 1. 7.
백준 10709번 기상캐스터(C++) 문제정답 코드#include #include #include #include using namespace std; int main() { ios:: sync_with_stdio(0); cin.tie(0); int n,m; cin >> n >> m; vector arr(n,vector(m,0)); for (int i = 0;i > s; for (int j=0; j < m;j++) { if (j != 0 && arr[i][j-1] == 0) arr[i][j] = 1; else if (j == 0 || s[j-1] == '.' && s[j] == '.' && arr[i][j-1] == -1) arr[i][j] = -1; else arr[i][j] = arr[i][.. 2023. 1. 6.
백준 2870번 수학숙제(overflow주의)(C++) 문제정답 코드#include #include #include #include using namespace std; void s_toi(string s,vector &arr) { char ar[100]; int aridx=0; int size = s.size(); long long ret =0; int flag = 0; for (int i=0;i n; vector arr; for (int i=0;i > s; s_toi(s,arr); } sort (arr.begin(),arr.end(),cmp); for (auto it : arr) { cout 2023. 1. 6.
백준 4559번 비밀번호 발음하기(C++) 문제정답 코드#include #include #include using namespace std; int is_have_small(char a) { if (a == 'a' || a=='e' || a =='i' || a== 'o' || a=='u') return (1); // cout 2023. 1. 6.
백준 c++백준 1181번 단어정렬 (부제 :c++의 말도 안되는 편리함) 실패코드 #include #include using namespace std; int ft_strcmp(char *str1, char *str2) { if(strlen(str1) !=strlen(str2)) { if (strlen(str1) > strlen(str2)) return (1); else return (-1); } while (*str1 == *str2 && *str1 && *str2) { str1++; str2++; } return (*str1 - *str2); } int main() { int inputnum; cin >> inputnum; char **arr = new char*[inputnum + 1]; char *tmp; for (int i = 0; i < inputnum; i++) .. 2023. 1. 5.