목록전체 글 (250)
정화 코딩
3회차 - n log n 정렬, 기초 수학 수 정렬하기 2 https://www.acmicpc.net/problem/2751C++ STL에 있는 정렬 함수를 사용한 풀이입니다. 정렬 함수를 사용하기 위해 헤더를 포함시켰습니다.#include #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector a(n); for (int i = 0; i > a[i]; sort(a.begin(), a.end()); for (int i = 0; i 수 정렬하기 3https://www.acm..

2회차 - 선형 자료구조, 제곱 정렬 에디터https://www.acmicpc.net/problem/1406#include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; list li(s.begin(), s.end()); int n; cin >> n; // 최초의 커서 위치는 문장의 맨 뒤 auto cur = li.end(); while (n--) { char cmd; cin >> cmd; if (cmd == 'L') { // ..

https://www.acmicpc.net/problem/12873 #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector a(n); for (int i = 0; i 태그는 큐인데 나는 그냥 vector와 erase 함수를 사용했다. 근데 여기서 주의할 점이 두 가지가 있다. (내가 여러번 틀린 이유...)1. cmath에 있는 pow(i, 3)를 사용하면 값이 의도대로 나오지 않을 수 있다. pow의 반환값이 double이라서 int로 바꾸는 과정에서 문제가 생길 수 있기 때문이다. 그래서 ..

https://www.acmicpc.net/problem/10830 #include #include using namespace std;int n;long long b;int mod = 1000;vector> mpow(vector> a, long long c) { vector> res(n, vector(n)); if (c == 1) { return a; } else if (c % 2 == 0) { vector> tmp = mpow(a, c / 2); for (int i = 0; i > tmp = mpow(a, c - 1); for (int i = 0; i > n >> b; vector> a(n, vector(n)); for (i..

https://www.acmicpc.net/problem/1406 #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; list li(s.begin(), s.end()); int n; cin >> n; // 최초의 커서 위치는 문장의 맨 뒤 auto cur = li.end(); while (n--) { char cmd; cin >> cmd; if (cmd == 'L') { // 커서가 맨 앞이 아니라면 한 칸 앞으로 이동..

https://www.acmicpc.net/problem/30885 #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); list> li; int n; cin >> n; for (int i = 1; i > x; li.emplace_back(x, i); } while (li.size() > 1) { for (auto i = li.begin(); i != li.end(); i++) { long long a = i->first; // 현재 가리키고 있는 미생물의 크기 ..

https://www.acmicpc.net/problem/31870 #include #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector a(n); for (int i = 0; i > a[i]; int ans = 1000000000; for (int k = 0; k at = a; int cnt = 0; for (int i = n - 1; i > 0; i--) { if (i == k) { reverse(at.b..

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