diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..97d8229 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,21 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "windowsSdkVersion": "10.0.22621.0", + "compilerPath": "C:/mingw64/bin/g++.exe", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "windows-gcc-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5c7247b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,7 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..13d6809 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,149 @@ +{ + "version": "2.0.0", + "runner": "terminal", + "type": "shell", + "echoCommand": true, + "presentation": { + "reveal": "always" + }, + "tasks": [ + { + "label": "save and compile for C++", + "command": "g++", + "args": [ + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "group": "build", + "problemMatcher": { + "fileLocation": [ + "relative", + "${workspaceRoot}" + ], + "pattern": { + "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "label": "save and compile for C", + "command": "gcc", + "args": [ + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "group": "build", + "problemMatcher": { + "fileLocation": [ + "relative", + "${workspaceRoot}" + ], + "pattern": { + "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "label": "execute", + "command": "cmd", + "group": { + "kind": "test", + "isDefault": true + }, + "args": [ + "/C", + "${fileDirname}\\${fileBasenameNoExtension}" + ], + "problemMatcher": [] + }, + { + "type": "cppbuild", + "label": "C/C++: gcc.exe 활성 파일 빌드", + "command": "C:\\MinGW\\bin\\gcc.exe", + "args": [ + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": "build", + "detail": "디버거에서 생성된 작업입니다." + }, + { + "type": "cppbuild", + "label": "C/C++: g++.exe 활성 파일 빌드", + "command": "C:\\MinGW\\bin\\g++.exe", + "args": [ + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": "build", + "detail": "디버거에서 생성된 작업입니다." + }, + { + "type": "cppbuild", + "label": "C/C++: gcc.exe 활성 파일 빌드", + "command": "C:\\MinGW\\bin\\gcc.exe", + "args": [ + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": "build", + "detail": "컴파일러: C:\\MinGW\\bin\\gcc.exe" + }, + { + "type": "cppbuild", + "label": "C/C++: g++.exe build active file", + "command": "C:\\mingw64\\bin\\g++.exe", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": "build", + "detail": "Task generated by Debugger." + } + ] +} \ No newline at end of file diff --git "a/10808\353\262\210\357\274\232 \354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230/\354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230.cpp" "b/10808\353\262\210\357\274\232 \354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230/\354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230.cpp" index 8951e7a..83c4ee3 100644 --- "a/10808\353\262\210\357\274\232 \354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230/\354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230.cpp" +++ "b/10808\353\262\210\357\274\232 \354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230/\354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230.cpp" @@ -13,16 +13,33 @@ #include using namespace std; +// int main(){ +// map a; +// string s; +// cin >> s; + +// for (int i = 0; i < s.length(); i++) +// { +// a[s[i]]++; +// } + +// for (char i = 'a'; i <= 'z'; i++) +// { +// cout << a[i] << ' '; +// } +// } + +int cnt[26]; int main(){ string s; cin >> s; - vector v(26); - for (char c : s) + for (int i= 0; i < s.length(); i++) { - v[c - 'a']++; + cnt[s[i] - 'a']++; } + for (int i = 0; i < 26; i++) { - cout << v[i] << ' '; + cout << cnt[i] << ' '; } } \ No newline at end of file diff --git "a/10808\353\262\210\357\274\232 \354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230/\354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230.exe" "b/10808\353\262\210\357\274\232 \354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230/\354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230.exe" new file mode 100644 index 0000000..5121ed2 Binary files /dev/null and "b/10808\353\262\210\357\274\232 \354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230/\354\225\214\355\214\214\353\262\263 \352\260\234\354\210\230.exe" differ diff --git a/2024/CodingTest/SummaryNote.md b/2024/CodingTest/SummaryNote.md index 2b4e9d2..a8bda4c 100644 --- a/2024/CodingTest/SummaryNote.md +++ b/2024/CodingTest/SummaryNote.md @@ -47,5 +47,7 @@ 누적합에 관한 내용, 배열을 써서 쉽게 품. -### 1-A +### 개수를 세는 문제 + +대부분의 개수를 세는 문제는 배열이나 맵을 사용하여 풀 수 있다.