목록문자열 (29)
정화 코딩

https://www.acmicpc.net/problem/16677 #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; int n; cin >> s >> n; int sn = s.size(); double ans = 0; string anss = "No Jam"; while (n--) { string a; double g; cin >> a >> g; int an = a.size(); int cnt = 0; int idx1 = 0; ..

https://www.acmicpc.net/problem/9935 #include #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s, bomb; cin >> s >> bomb; stack stk; int n = bomb.size(); for (char c: s) { if (c == bomb[n - 1]) { for (int i = n - 2; i >= 0; i--) { if (stk.empty()) { for (int..

https://www.acmicpc.net/problem/10174 #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tn; cin >> tn; while (tn--) { string s; getline(cin, s); int n = s.length(); for (int i = 0; i = 'A' && s[i] 공백이 들어올 수 있기 때문에 string으로 받는 것이 아니라 한 줄 전체를 받아야 한다.C++ 한 줄 입력받기: getline(cin, s);근데 위의 코드를 돌리면 반복문이 n-1번..

https://www.acmicpc.net/problem/5534 #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; int ss = s.size(); int ans = 0; for (int i = 0; i > st; int sts = st.size(); bool psb = false; for (int j = 0; j = ss) { psb = true; ..

https://www.acmicpc.net/problem/1622 #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s1, s2; while (getline(cin, s1)) { getline(cin, s2); int cnt1[26] = {}; int cnt2[26] = {}; for (char c: s1) cnt1[c - 'a']++; for (char c: s2) cnt2[c - 'a']++; for (int i = 0; i 정렬 태그에 속았는데;; 결국 중요한 건 ..

https://www.acmicpc.net/problem/17419 #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; string k; cin >> n >> k; int cnt = 0; for (char c: k) { if (c == '1') cnt++; } cout 처음에는 n 크기를 k크기로 잘못봐서 그냥 0이 될 때까지 연산을 계속하도록 했다. 그랬더니 서브태스크 1도 못함...ㅎ (WA) 생각해보니 이진수의 자리수가 1,000,000까지 될 수 있다는 거니까 일단 식의 규칙을 찾고 ..

https://www.acmicpc.net/problem/5525 #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; string str; cin >> n >> m >> str; int l = 2 * n + 1; string ioi = ""; for (int i = 0; i 이 문제는 서브태스크 문제였는데, 이 코드로는 50점이 나온다. 앞에서부터 substring을 하나하나 비교하는 방식인데, 정답을 받으려면 더 빠른 방법이 필요한 것 같다. (PA) #include #include using name..

https://www.acmicpc.net/problem/29768 #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; char str[n]; int i = 0; // idx for (; i = n) break; str[i] = 'a' + j; i++; } int j = i - 2; for (; i 처음에는 이렇게 풀어서 틀렸다. (WA) 질문게시판을 보니 나와 똑같이 푼 사람을 발견했다. 반례는 다음과 같다. input : 10 2ouput : aaaabb..