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 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