diff --git "a/week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/arenran02/Main.c" "b/week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/arenran02/Main.c" new file mode 100644 index 00000000..8249aea3 --- /dev/null +++ "b/week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/arenran02/Main.c" @@ -0,0 +1,93 @@ +#include +#include +#include +#include + +// 노드 정의 +typedef struct node { + char data; + struct node* next; +} node; + +// 스택 구조체 +typedef struct { + node* top; + int size; +} STACK; + +// 스택 함수 정의 +void init_STACK(STACK* s) { + s->top = NULL; + s->size = 0; +} + +int is_stack_empty(STACK* s) { + return s->size == 0; +} + +void push_stack(STACK* s, char data) { + node* newnode = malloc(sizeof(node)); + newnode->data = data; + newnode->next = s->top; + s->top = newnode; + s->size++; +} + +char pop_stack(STACK* s) { + if (is_stack_empty(s)) return '\0'; + node* temp = s->top; + char data = temp->data; + s->top = temp->next; + s->size--; + free(temp); + return data; +} + +void flush_stack(STACK* s) { + while (!is_stack_empty(s)) { + printf("%c", pop_stack(s)); + } +} + +int main() { + char str[100001]; + fgets(str, sizeof(str), stdin); + + STACK s; + init_STACK(&s); + + int in_tag = 0; + + for (int i = 0; str[i] != '\0'; i++) { + char c = str[i]; + + if (c == '<') { + // 단어 뒤집기 마무리하고 태그 출력 시작 + flush_stack(&s); + in_tag = 1; + printf("%c", c); + } + else if (c == '>') { + in_tag = 0; + printf("%c", c); + } + else if (in_tag) { + // 태그 안: 그대로 출력 + printf("%c", c); + } + else { + // 태그 밖 + if (c == ' ' || c == '\n') { + flush_stack(&s); + printf("%c", c); + } else { + push_stack(&s, c); + } + } + } + + // 마지막 남은 단어 뒤집기 + flush_stack(&s); + + return 0; +} diff --git "a/week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/arenran02/Main.cpp" "b/week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/arenran02/Main.cpp" new file mode 100644 index 00000000..bfb6ce86 --- /dev/null +++ "b/week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/arenran02/Main.cpp" @@ -0,0 +1,26 @@ +#include +#include +#include + +int main() { + int N; + std::cin >> N; + std::map extensionCount; + + for (int i = 0; i < N; ++i) { + std::string filename; + std::cin >> filename; + + size_t pos = filename.rfind('.'); + if (pos != std::string::npos) { + std::string extension = filename.substr(pos + 1); + ++extensionCount[extension]; + } + } + + for (const auto& pair : extensionCount) { + std::cout << pair.first << " " << pair.second << "\n"; + } + + return 0; +} diff --git a/week7/simulation/ZOAC3/arenran02/Main.cpp b/week7/simulation/ZOAC3/arenran02/Main.cpp new file mode 100644 index 00000000..15ff286e --- /dev/null +++ b/week7/simulation/ZOAC3/arenran02/Main.cpp @@ -0,0 +1,75 @@ +#include +using namespace std; + +int map[3][10]; + +string top = "qwertyuiop"; +string middle = "asdfghjkl"; +string bottom = "zxcvbnm"; + +struct Info{ + int r; + int c; + char hand; +}; + +Info l, r; + +Info find_coor(char key){ +    int _r = 0, _c = 0; +    char hand; +    for(int i=0; i>left>>right; +    string s; cin>>s; +     +    l = find_coor(left); +    r = find_coor(right); +    int ans = 0; +    for(char key: s) ans += find_dist(key); +     +    cout<