백준 5052 전화번호 목록(c++)
·
PS/String
https://www.acmicpc.net/problem/5052 5052번: 전화번호 목록 첫째 줄에 테스트 케이스의 개수 t가 주어진다. (1 ≤ t ≤ 50) 각 테스트 케이스의 첫째 줄에는 전화번호의 수 n이 주어진다. (1 ≤ n ≤ 10000) 다음 n개의 줄에는 목록에 포함되어 있는 전화번호가 www.acmicpc.net #include #include #include #include using namespace std; bool consistency(vectorv){ for(int i=0;it; while(t--) { cin>>n; for(int i=0;i>num; v.push_back(num); } sort(v.begin(),v.end()); bool ans = consistency(v)..
백준 1213 팰린드롬 만들기(c++)
·
PS/String
https://www.acmicpc.net/problem/1213
백준 16916 부분 문자열(c++)
·
PS/String
https://www.acmicpc.net/problem/16916 16916번: 부분 문자열 첫째 줄에 문자열 S, 둘째 줄에 문자열 P가 주어진다. 두 문자열은 빈 문자열이 아니며, 길이는 100만을 넘지 않는다. 또, 알파벳 소문자로만 이루어져 있다. www.acmicpc.net #include #include #include #include using namespace std; int main() { string s,p; cin>>s>>p; if(s.find(p)!=string::npos) cout
백준 15353 큰 수 A+B(c++)
·
PS/String
https://www.acmicpc.net/problem/15353 15353번: 큰 수 A+B (2) C++17, C11, C99, C++98, C++11, C++14, C99 (Clang), C++98 (Clang), C++11 (Clang), C++14 (Clang), C11 (Clang), C++17 (Clang) www.acmicpc.net #include #include #include #include #include using namespace std; int main() { string a,b; cin>>a>>b; dequev1; dequev2; vectorans; vector::iterator it; for(int i=0;iv2.size()) { for(int i=0;i
백준 11478 서로 다른 부분 문자열의 개수(c++)
·
PS/String
https://www.acmicpc.net/problem/11478 11478번: 서로 다른 부분 문자열의 개수 첫째 줄에 문자열 S가 주어진다. S는 알파벳 소문자로만 이루어져 있고, 길이는 1,000 이하이다. www.acmicpc.net #include #include #include #include #include #include using namespace std; int main() { string str; sets; vectorv; cin>>str; for(int i=0;i
백준 1120 문자열(c++)
·
PS/String
https://www.acmicpc.net/problem/1120 1120번: 문자열 길이가 N으로 같은 문자열 X와 Y가 있을 때, 두 문자열 X와 Y의 차이는 X[i] ≠ Y[i]인 i의 개수이다. 예를 들어, X=”jimin”, Y=”minji”이면, 둘의 차이는 4이다. 두 문자열 A와 B가 주어진다. 이때, A의 www.acmicpc.net #include #include #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string a,b; cin>>a>>b; int cnt=0; if(a.size()==b.size()) { for(int i=0;i
백준 1431 시리얼 번호(c++)
·
PS/String
https://www.acmicpc.net/problem/1431 1431번: 시리얼 번호 첫째 줄에 기타의 개수 N이 주어진다. N은 50보다 작거나 같다. 둘째 줄부터 N개의 줄에 시리얼 번호가 하나씩 주어진다. 시리얼 번호의 길이는 최대 50이고, 알파벳 대문자 또는 숫자로만 이루어 www.acmicpc.net #include #include #include #include #include #include using namespace std; bool cmp(string s1,string s2) { int sums1 = 0; int sums2 = 0; if(s1.size()==s2.size()) { for(int i=0;i='0' && s1[i]='0' && s2[i]
백준 11656 접미사 배열(c++)
·
PS/String
https://www.acmicpc.net/problem/11656 11656번: 접미사 배열 첫째 줄에 문자열 S가 주어진다. S는 알파벳 소문자로만 이루어져 있고, 길이는 1,000보다 작거나 같다. www.acmicpc.net #include #include #include #include using namespace std; int main() { string str; vectorv; cin>>str; for(int i=0;i
백준 1212 8진수 2진수(c++)
·
PS/String
https://www.acmicpc.net/problem/1212 1212번: 8진수 2진수 첫째 줄에 8진수가 주어진다. 주어지는 수의 길이는 333,334을 넘지 않는다. www.acmicpc.net #include #include #include using namespace std; string eight[8] = {"000","001","010","011","100","101","110","111"}; int main(){ string s; cin >> s; if(s=="0") cout
백준 1373 2진수 8진수(c++)
·
PS/String
https://www.acmicpc.net/problem/1373 1373번: 2진수 8진수 첫째 줄에 2진수가 주어진다. 주어지는 수의 길이는 1,000,000을 넘지 않는다. www.acmicpc.net #include #include #include #include using namespace std; int main() { string s; cin>>s; int n = s.size(); if(n%3==1) cout