From 2e65bc9cb606b2e96067fd6d3636364370e672cd Mon Sep 17 00:00:00 2001 From: csb9427 Date: Sun, 2 Apr 2023 17:26:01 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[=EB=AC=B8=EC=9E=90=EC=97=B4]=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EB=9E=98=EB=A8=B8=EC=8A=A4=20=EC=88=AB?= =?UTF-8?q?=EC=9E=90=20=EB=AC=B8=EC=9E=90=EC=97=B4=EA=B3=BC=20=EC=98=81?= =?UTF-8?q?=EB=8B=A8=EC=96=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... \354\230\201\353\213\250\354\226\264.cpp" | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 "string/p\354\210\253\354\236\220 \353\254\270\354\236\220\354\227\264\352\263\274 \354\230\201\353\213\250\354\226\264.cpp" diff --git "a/string/p\354\210\253\354\236\220 \353\254\270\354\236\220\354\227\264\352\263\274 \354\230\201\353\213\250\354\226\264.cpp" "b/string/p\354\210\253\354\236\220 \353\254\270\354\236\220\354\227\264\352\263\274 \354\230\201\353\213\250\354\226\264.cpp" new file mode 100644 index 0000000..48e2872 --- /dev/null +++ "b/string/p\354\210\253\354\236\220 \353\254\270\354\236\220\354\227\264\352\263\274 \354\230\201\353\213\250\354\226\264.cpp" @@ -0,0 +1,70 @@ +#include +#include +#include +using namespace std; + +int solution(string s) { + int answer = 0; + string v; + for (int i = 0; i < s.size(); i++) { + if (s[i] == 'z') { + i = i + 3; + v = v + "0"; + } + else if (s[i] == 'o') { + i = i + 2; + v = v + "1"; + } + else if (s[i] == 't') { + if (s[i + 1] == 'w') { + i = i + 2; + v = v + "2"; + } + else if (s[i + 1] == 'h') { + i = i + 4; + v = v + "3"; + } + } + else if (s[i] == 'f') { + if (s[i + 1] == 'o') { + i = i + 3; + v = v + "4"; + } + else if (s[i + 1] == 'i') { + i = i + 3; + v = v + "5"; + } + } + else if (s[i] == 's') { + if (s[i + 1] == 'i') { + i = i + 2; + v = v + "6"; + } + else if (s[i + 1] == 'e') { + i = i + 4; + v = v + "7"; + } + } + else if (s[i] == 'e') { + i = i + 4; + v = v + "8"; + } + else if (s[i] == 'n') { + i = i + 3; + v = v + "9"; + } + else { + v = v + s[i]; + } + } + answer = stoi(v); + cout << answer; + return answer; +} + +int main() { + string s; + cin >> s; + solution(s); + return 0; +} \ No newline at end of file From 2ed53723d02a68abbc36c77b24ed51d13103fd2a Mon Sep 17 00:00:00 2001 From: csb9427 Date: Mon, 3 Apr 2023 16:52:14 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[bruteforce]=20=ED=94=84=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=EB=A8=B8=EC=8A=A4=20=EC=86=8C=EC=88=98=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\210\230 \353\247\214\353\223\244.cpp" | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 "bruteforce/p\354\206\214\354\210\230 \353\247\214\353\223\244.cpp" diff --git "a/bruteforce/p\354\206\214\354\210\230 \353\247\214\353\223\244.cpp" "b/bruteforce/p\354\206\214\354\210\230 \353\247\214\353\223\244.cpp" new file mode 100644 index 0000000..a4ffaa6 --- /dev/null +++ "b/bruteforce/p\354\206\214\354\210\230 \353\247\214\353\223\244.cpp" @@ -0,0 +1,31 @@ +#include +#include +using namespace std; + +int abc(int num) { + int count = 0; + for (int i = 2; i <= num; i++) { + if (num % i == 0) { + count++; + } + } + return count; +} + +int solution(vector nums) { + int answer = 0; + int num = 0; + for (int i = 0; i < nums.size(); i++) { + for (int j = i + 1; j < nums.size(); j++) { + for (int k = j + 1; k < nums.size(); k++) { + num = nums[i] + nums[j] + nums[k]; + int count = abc(num); + if (count == 1) { + answer++; + } + } + } + } + + return answer; +} \ No newline at end of file