코드 #include using namespace std; int n,m,res,cnt; int graph[14][14]; int visited[14][14]; // 매번 업데이트 시켜줘야함 int dx[] = {1,-1,0,0}; int dy[] = {0,0,1,-1}; vector wall; vector virus; void dfs(int x, int y) { visited[x][y] = 1; for(int i = 0; i = n || ny >= m || nx < 0 || ny < 0) continue; if (graph[nx][ny] != 1 && !visited[nx][ny]) dfs(nx,n..
C++
코드 #include using namespace std; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); while(1) { cin >> s; bool vowel = false, dusthr = true, same = true; int mo = 0,ja = 0; if (s=="end") break; for(int i = 0; i < s.length(); i++) { if (s[i] == 'a'||s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u') { vowel = true; mo++; ja = 0; if (mo == 3) dusthr = fal..
코드 #include using namespace std; int n; int main() { cin >> n; int cnt = 0; int five = 5; while (five
코드 #include using namespace std; int t,n; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> t; while(t--) { cin >> n; int cnt = 0; int five = 5; while (five
자료형 변환 함수 1. string을 int형으로: stoi(string 변수); 2. int를 string으로: to_string(int 변수); to_string(a).find("666") 3. string을 char*로: string변수.c_str(); 4. char*을 int형으로: atoi(char* 변수); 5. char*를 string으로: 바로 할당해주면 됨 참고자료 https://comyoung.tistory.com/269
입출력 #include using namespace std; // std::를 안붙여도 됨 int main(void) { int a, b; cin >> a >> b; # 한 칸 띄우고 입력 받기, ex) 1 2 cout 연산자와 함께 사용자의 입력을 받는다. cout: c의 printf와 같은 역할. > a >> b; cout.precision(10); // cout은 실수를 출력할 때 기본적으로 6자리까지 출력 cout