목록전체 글 (251)
정화 코딩

https://www.acmicpc.net/problem/14500 #include #include using namespace std;int dx[][3] = { {1, 1, 1}, {0, 0, 0}, {1, 0, -1}, {0, 0, 1}, {1, 0, 0}, {0, 0, 1}, {1, 0, 0}, {0, 1, 1}, {1, 1, 0}, {0, 1, 1}, {1, 1, 0}, {0, 1, 0}, {0, -1, 0}, {-1, 0, -1}, {-1, 0, -1}, {-1, 1, 1}, {-1, 1, 1}, {1, 0, 0}, {-1, 0, 0}};int dy[][3] = { {0, 0, 0}, {1, 1, 1}, {0, 1, 0}, {-1, -1,..

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 정렬 태그에 속았는데;; 결국 중요한 건 ..

EC2 인스턴스 생성하기AWS에서 회원 가입 후 로그인을 한다. 루트 사용자 이메일로 로그인 하면 된다.(AWS는 내가 알기로 1년 동안 무료로 사용 가능하고, 기한이 끝나면 다른 메일 주소로 새로운 계정을 만들어서 사용하면 된다고 한다.)메뉴에서 ec2를 클릭하고 "인스턴스 시작" 버튼을 클릭해준다. 이름 및 태그: 원하는 이름으로 설정한다.애플리케이션 및 OS 이미지(Amazon Machine Image): 원하는 운영체제를 선택한다. 나는 리눅스를 선택하였다.인스턴스 유형: 프리티어 사용 가능한 것으로 설정한다. 아마도 기본으로 t2.micro로 되어있을 것이다.키 페어(로그인): 이미 키가 있다면 선택해주면 되고, 없다면 새 키 페어를 생성해준다. 나머지 설정들은 그대로 두고 "인스턴스 시작"을 ..

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/6064 #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int m, n, x, y; cin >> m >> n >> x >> y; int k = 0; bool psb = false; for (int i = 0; i 잘 모르겠어서 태그를 깠더니 난생 처음 보는 중국인의 나머지 정리..?? 이게 뭐야 하면서 질문 게시판을 슬쩍 보니 중국인의 나머지 정리를 쓰지 않아도 풀 수 있는 ..

https://www.acmicpc.net/problem/19699 #include #include #include #include using namespace std;bool p[10000];int n, m;vector h;vector chk;set ans;void dfs(int idx, int res) { if (idx == m) { if (res > n >> m; h = vector(n); chk = vector(n, false); for (int i = 0; i > h[i]; sort(h.begin(), h.end()); dfs(0, 0); if (ans.empty()) { cout 우선 에라토스테네스 체로 1부터 10000까지 범위에..

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/9019 #include #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int start, end; cin >> start >> end; vector vst(10000, false); queue> q; q.emplace(start, ""); vst[start] = true; while (!q.empty()) { in..