python

백준 1/기초

[백준 2908] 상수 (C++/Python)

C++) #include #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string a, b; cin >> a >> b; reverse(a.begin(), a.end()); reverse(b.begin(), b.end()); cout

백준 1/기초

[백준 1316] 그룹 단어 체커 (C++/Python)

C++) #include #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); bool arr[26]; int ans = 0; int t; cin >> t; while (t--) { string str; cin >> str; char past = '\0'; bool flag = false; fill(arr, arr + 26, false); for (auto ch : str) { if (!arr[ch - 'a'] && past != ch) { arr[ch - 'a'] = true; past = ch; } else if (arr[ch - 'a'] && past != ch..

백준 1/기초

[백준 10824] 네 수 (C++/Python)

C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string a, b, c, d; cin >> a >> b >> c >> d; cout

백준 1/기초

[백준 10808] 알파벳 개수 (C++ / Python)

#include #include using namespace std; int arr[27]; int main(void){ string s; cin >> s; for(int i=0; i

백준 1/기초

[백준 11655] ROT 13 (C++/Python)

C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string str; getline(cin, str); string ans = ""; for (auto ch : str) { if (!isalpha(ch)) { ans += ch; continue; } if (islower(ch)) ans += (ch - 'a' + 13) % 26 + 'a'; else ans += (ch - 'A' + 13) % 26 + 'A'; } cout

백준 1/기초

[백준 2743] 단어 길이 재기 (C++/Python)

C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string str; cin >> str; cout

백준 1/기초

[백준 10886] 0 = not cute / 1 = cute (C++/Python)

C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, temp; cin >> n; int op[2] = { 0,0 }; for (int i = 0; i > temp; op[temp] ++; } if (op[1] > op[0]) cout

백준 1/기초

[백준 1157] 단어 공부 (C++/Python)

C++) #include #include #include #include using namespace std; bool compare(pair m1, pair m2) { if (m1.second == m2.second) return m1.first > m2.first; else return m1.second > m2.second; } int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string str; cin >> str; // 대문자로 변환 transform(str.begin(), str.end(), str.begin(), ::toupper); vector v; for (char ch = 'A'; ch

백준 1/기초

[백준 2675] 문자열 반복 (C++/Python)

C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { int n; string temp; cin >> n >> temp; for (auto ch : temp) { for (int i = 0; i < n; i++) cout

백준 1/기초

[백준 1152] 단어의 개수 (C++/Python)

C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string str; getline(cin, str); int ans = 0; bool flag = false; for (auto ch : str) { if (isalpha(ch)) { flag = true; } // 공백임 else { if (flag) { ans += 1; flag = false; } } } if (flag) ans += 1; cout

핑구ovo
'python' 태그의 글 목록 (12 Page)