Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7-YIM2UL2ET #23

Merged
merged 4 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion YIM2UL2ET/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
| 2μ°¨μ‹œ | 2024.02.15 | 그리디 | [BOJ 1263](https://www.acmicpc.net/problem/1263) | [BOJ 1449 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/7) |
| 3μ°¨μ‹œ | 2024.02.18 | μŠ€νƒ | [BOJ 2504](https://www.acmicpc.net/problem/2504) | [BOJ 2504 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/9) |
| 4μ°¨μ‹œ | 2024.02.21 | 덱 | [BOJ 1021](https://www.acmicpc.net/problem/1021) | [BOJ 1021 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/12) |
| 5μ°¨μ‹œ | 2024.02.21 | 큐 | [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) |
| 5μ°¨μ‹œ | 2024.02.24 | 큐 | [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) |
| 6μ°¨μ‹œ | 2024.02.27 | μ •λ ¬ | [BOJ 1599](https://www.acmicpc.net/problem/1599) | [BOJ 1599 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/21) |
| 7μ°¨μ‹œ | 2024.03.01 | μž¬κ·€ | [BOJ 2705](https://www.acmicpc.net/problem/2705) | [BOJ 2705 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/23) |
---
23 changes: 23 additions & 0 deletions YIM2UL2ET/μž¬κ·€/7μ°¨μ‹œ -BOJ 2705.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>

int ary[1000] = {0};

int solve(int n)
{
if (ary[n-1] != 0) return ary[n-1];
for (int i = 0; n-i*2 > 1;) ary[n-1] += solve(++i);
return ++ary[n-1];
}

int main(void)
{
int n, input;
ary[0] = 1;

std::cin >> n;
for (int i = 0; i < n; i++) {
std::cin >> input;
std::cout << solve(input) << std::endl;
}
return 0;
}
36 changes: 36 additions & 0 deletions YIM2UL2ET/μ •λ ¬/6μ°¨μ‹œ - BOJ 1599.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <iostream>
#include <algorithm>

std::string translation(std::string min_str)
{
int s_diff = 0;
std::string alpha_str = min_str;
for (int i = 0; i < min_str.size(); i++) {
if (min_str[i] == 'k') alpha_str[i-s_diff] = 'c';
else if (min_str[i] > 'n') alpha_str[i-s_diff]++;
else if (min_str[i] == 'n' && i+1 < min_str.size() && min_str[i+1] == 'g') {
alpha_str.erase(alpha_str.begin() + (i++) - s_diff);
alpha_str[i - (++s_diff)] = 'o';
}
}
return alpha_str;
}

bool compare(std::string str1, std::string str2)
{
return translation(str1) < translation(str2);
}

int main(void)
{
int n;
std::cin >> n;

std::string min_str[n];
for (int i = 0; i < n; i++) std::cin >> min_str[i];

std::sort(min_str, min_str+n, compare);

for (int i = 0; i < n; i++) std::cout << min_str[i] << std::endl;
return 0;
}